Getimagesize ( ) Error message Please Help!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philip D Heady

    #1

    Getimagesize ( ) Error message Please Help!

    What is with this error message?????? First part validates, second part
    fails...

    getimagesize (filename...) failed to open stream: No such file or directory

    } elseif ($photo) {

    $ext = strtolower(subs tr($photo, -3));

    if ($ext == "peg") { $ext = "jpg"; }

    if ($ext != "gif" && $ext != "jpg" && $ext != "jpeg" && $ext != "bmp" )
    {

    $focus = "photo";
    $msg2 = "Please provide a valid gif, jpeg, or bmp photo or do not
    attach one.";

    } else {

    $size = getimagesize($p hoto);

    if ($size > 25000) {

    $msg2 = "Photo must be smaller than 25k.";


    }}}


  • Shawn Wilson

    #2
    Re: Getimagesize ( ) Error message Please Help!

    Philip D Heady wrote:[color=blue]
    >
    > What is with this error message?????? First part validates, second part
    > fails...
    >
    > getimagesize (filename...) failed to open stream: No such file or directory
    >
    > } elseif ($photo) {
    >
    > $ext = strtolower(subs tr($photo, -3));
    >
    > if ($ext == "peg") { $ext = "jpg"; }
    >
    > if ($ext != "gif" && $ext != "jpg" && $ext != "jpeg" && $ext != "bmp" )
    > {
    >
    > $focus = "photo";
    > $msg2 = "Please provide a valid gif, jpeg, or bmp photo or do not
    > attach one.";
    >
    > } else {
    >
    > $size = getimagesize($p hoto);
    >
    > if ($size > 25000) {
    >
    > $msg2 = "Photo must be smaller than 25k.";
    >
    > }}}[/color]

    What is $photo? It should be a URL or a path to a file (either absolute or
    relative). However, if you get it working, you'll run into a problem with the
    next line. First, getimagesize() returns an array. Second, none of the
    elements in the array relate to filesize. They relate to it's type, height and
    width.



    You should read about filesize():



    Or if this is a file the user has uploaded, try using:
    $_FILES['photo']['size']



    Shawn
    --
    Shawn Wilson
    shawn@glassgian t.com

    Comment

    Working...