Warning: getimagesize(...)failed to open stream: Permission Denied in ...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bluesky9394
    New Member
    • May 2007
    • 3

    #1

    Warning: getimagesize(...)failed to open stream: Permission Denied in ...

    I encounter the following error.

    Warning: getimagesize(We bRoot/common/images/profile/) [function.getima gesize]: failed to open stream: Permission denied in C:\Data\PHPSite s\kamwo\indextm p-new.php on line 296

    but it's working fine on my another php script.

    php code:
    [code=php]
    $path = "WebRoot/common/images/profile/";
    $file = $row1['imgdata'];
    $width;
    $height;
    list($width, $height, $type, $attr) = getimagesize($p ath.$file);
    if ($width > 102 || $height > 76){
    if($width > $height){
    $percentage = 102/$width;
    }
    else{
    $percentage = 76/$height;
    }
    $width = $width*$percent age;
    $height = $height*$percen tage;
    }[/code]

    [Please use CODE tags when posting source code. Thanks! --pbmods]
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, bluesky9394. Welcome to TSDN!

    Originally posted by bluesky9394
    I encounter the following error.

    Warning: getimagesize(We bRoot/common/images/profile/) [function.getima gesize]: failed to open stream: Permission denied in C:\Data\PHPSite s\kamwo\indextm p-new.php on line 296
    Make sure your web server has permission to access that file. Check the permissions on your indextmp-new.php file and copy them over to your image files/folders (make sure especially that your webserver 'User' has write permissions as well!).

    Comment

    • bluesky9394
      New Member
      • May 2007
      • 3

      #3
      Originally posted by pbmods
      Make sure your web server has permission to access that file. Check the permissions on your indextmp-new.php file and copy them over to your image files/folders (make sure especially that your webserver 'User' has write permissions as well!).
      Thank you for reply me. I set "everyone" has full permission on the file and folder. Also, I created a same script on the same folder, it was working fine.
      Only the indextmp-new.php is not working.

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        What's the output of:

        [code=php]echo $path.$file;[/code]

        Comment

        • bluesky9394
          New Member
          • May 2007
          • 3

          #5
          the output is:

          WebRoot/common/images/profile/pic.jpg

          Comment

          • elvisob
            New Member
            • Jun 2014
            • 1

            #6
            The trouble is php version, check your version and change the function if necessary.

            Comment

            • meditation
              New Member
              • Jun 2014
              • 13

              #7
              I assume you have read and write permission for both directory as well as image. Else are you using virtual server?

              Comment

              Working...