PHP – having problems with getimagesize() when space in filename?

Some images containing spces in the file name led me to some errors when trying to determine their image size for manipulation using PHP.

Simply url encoding the string fixed this problem.
 

 <?php
  $imagePath = "some funky filename.jpg";
  $imagePath = str_replace(" ","%20",$imagePath);
  list($imgwidth,$imgheight) = getimagesize($imagePath);
?>
 |  Comment (RSS)  |  Trackback

Leave a Reply

*

*(will not be published)


− one = 6