0

I want to get the width value of an image using "getimagesize", but php doesn't seem to get the variables from the function's array through the "list" function.

list($width, $height) = getimagesize($file);
echo $width; 

i get $width as undefined.

What might be causing this?

Thanks.

4
  • Are you sure the path to $file is correct and is an image? Commented Aug 15, 2014 at 15:48
  • what is in $file? is it accessible? Commented Aug 15, 2014 at 15:48
  • stackoverflow.com/a/4742105 as an example. So, it could be your path. Commented Aug 15, 2014 at 15:52
  • Yes, the file is accessible, I'm viewing the $file after these lines. Commented Aug 15, 2014 at 16:14

1 Answer 1

0
<?php
list($width, $height) = getimagesize("http://hdnewwallpapers.com/wp-content/uploads/2014/04/Green-Eyes-Girls.jpg");
echo $width;
echo "<br />";
echo $height;
?>

and result is

1024 682

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.