Inspecting Images

Discussion in 'Web Design' started by Glenn, Apr 18, 2019.

to remove all ads.
  1. Glenn

    Glenn Member

    Messages:
    207
    I've created this to get the size of several images I have in a directory....

    $image = file_get_contents("$fileLocation");
    $source = imagecreatefromstring($image);

    $width = imagesx($source);
    $height = imagesy($source);
    echo " &nbsp; width : ", $width, " $nbsp; height : ", $height, "<br><br>";



    When it gets to an image with a name that has a space in the name, it gives me an error....

    Warning: imagecreatefromstring(): Data is not in a recognized format in /setupdb.php on line 23

    Warning: imagesx() expects parameter 1 to be resource, boolean given in /setupdb.php on line 25

    Warning: imagesy() expects parameter 1 to be resource, boolean given in /setupdb.php on line 26



    What do I need to add to get it to read them better?
     

Share This Page