By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 986 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

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

P: 3
I encounter the following error.

Warning: getimagesize(WebRoot/common/images/profile/) [function.getimagesize]: failed to open stream: Permission denied in C:\Data\PHPSites\kamwo\indextmp-new.php on line 296

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

php code:
Expand|Select|Wrap|Line Numbers
  1. $path = "WebRoot/common/images/profile/";
  2. $file = $row1['imgdata'];
  3. $width;
  4. $height;
  5. list($width, $height, $type, $attr) = getimagesize($path.$file);
  6. if ($width > 102 || $height > 76){
  7.     if($width > $height){
  8.         $percentage = 102/$width;
  9.     }
  10.     else{
  11.         $percentage = 76/$height;
  12.     }
  13. $width = $width*$percentage;
  14. $height = $height*$percentage;
  15. }
[Please use CODE tags when posting source code. Thanks! --pbmods]
May 25 '07 #1
Share this Question
Share on Google+
6 Replies


pbmods
Expert 5K+
P: 5,821
Heya, bluesky9394. Welcome to TSDN!

I encounter the following error.

Warning: getimagesize(WebRoot/common/images/profile/) [function.getimagesize]: failed to open stream: Permission denied in C:\Data\PHPSites\kamwo\indextmp-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!).
May 27 '07 #2

P: 3
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.
May 28 '07 #3

pbmods
Expert 5K+
P: 5,821
What's the output of:

Expand|Select|Wrap|Line Numbers
  1. echo $path.$file;
May 28 '07 #4

P: 3
the output is:

WebRoot/common/images/profile/pic.jpg
May 28 '07 #5

P: 1
The trouble is php version, check your version and change the function if necessary.
Jun 8 '14 #6

P: 13
I assume you have read and write permission for both directory as well as image. Else are you using virtual server?
Jun 9 '14 #7

Post your reply

Sign in to post your reply or Sign up for a free account.