0

Hello Guys

In some part of my coding i want to obtain the width and height of an image in terms of PIXELs
I tried the following

//the rest above aren't important
$path = $_SERVER[DOCUMENT_ROOT].'/images/'.$image;
           $imgdata = getimagesize($path); 
           $imgdata[0] = $width;
           $imgdata[1] = $height;
           If ($width > 800 || $height > 600) {
            //do some work here
           }

When i added the if statement , the code between curly braket don't get executed(no error shown though).However if i remove the if condition , my code get executed
I believe error is one of these
1.Some error in if statement - less probable
2.The getimagesize is wrong or don't return values in pixels(most likely)

I know someone will point out the error :)

Thanks in advance

Edited by Khav: corrected grammatical mistake

2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by Khav
1

Change this part:

$imgdata[0] = $width;
$imgdata[1] = $height;

with this:

$width = $imgdata[0];
$height = $imgdata[1];

bye!

Votes + Comments
The awesome helper of all time~Khav
0

Perfect bro........How could i missed such an obvious mistake lol
Finally found how to Rep.........+1 from me

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.