I am migrating a site from a server that has PHP 4.2.2 to a server that has PHP 4.3.9. On the PHP 4.2.2 server getimagesize worked just fine, but on the PHP 4.3.9 server it does not work.

Here is the code.

list($width, $height) = getimagesize(rtrim("images/eventid_" . $row['event_id'] . "_images/" . $row['picture']));
echo $width . "  " . $height . " width and height";

The width and the height don't echo anything.

Is there another way of getting the image size?

    Is display_errors set to On and error_reporting set to E_ALL ?

    Also, is there any reason you're still using a very, very old (and dieing) version of PHP?

      Let's make your code more readable and easier to debug

      $filename = "images/eventid_" . $row['event_id'] . "_images/" . $row['picture'];
      $filename = rtrim($filename);
      $size = getimagesize($filename);
      $width = $size[0];
      $height = $size[1];
      

      Break the problem down into smaller parts:

      Check $width, $height, $filename. Are they ok?
      How about $row['event_id'] and $row['picture']?
      Now, check $width and $height. Are they ok?
      Does $filename exist on disk?
      Is $filename a well formed URL? Did you switch to a funky naming convention?
      Are there bad characters in there like spaces that should be %20?

      Brevity isn't always the best way to write code especially when you run into ugly problems like this. My hunch is that your filenaming convention changed.

        Write a Reply...