PDA

View Full Version : getimagesize


Tim Mousel
Mon 14th Oct '02, 1:07am
$size = GetImageSize("./images/$username.jpg");
$imagetype = $size[2];

echo "$imagetype"; //this prints out the browser as a value of "2"

if (($imagetype != 1) || ($imagetype != 2)) {
echo "<p><strong><font color=#FF0000>Sorry, your logo is the wrong format! </font></strong></p>
<p>Your logo has to be either a .gif or a .jpg. </p>
<p>Please select a different format
and <a href=\"/directory/profile4_logo.php?<?=SID?>\">try again</a>. </p>";
exit;
}


This works:

if (($size[2] != 2)) {


This doesn't:

if (($size[2] != 1) || ($size[2] != 2)) {


Even though $imagetype is equal to 2, this if statement is still printing out, "Sorry, your logo is....".

Why? If $imagetype is equal to two why is the statement being flagged?

Thanks,

Tim

Marsupilami
Wed 16th Oct '02, 8:10pm
It's a logic thing.

it should be:
if (($imagetype != 1) && ($imagetype != 2)) {

Regards, Johan

Tim Mousel
Wed 16th Oct '02, 11:55pm
Thank you very much! I guess that show my illogical side!

Tim