500 Error with PHP Thumbnail script..

  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

Registered: Jan 2003
Location:
Posts: 30
500 Internal Server Error with Thumbnailing Script

I just implemented into my script a function that takes an image, and resizes it at increments (ie. if the image is 800x600, it will resize it to 640x480 and 160x100). If I upload a large image (over 1600x1200) the script runs through six resizing/resamplings of the image.
That is all fine and good, but now when I try to upload two images at the same time, it gets part way throug the resizing of the second image, quits, and throws up the 500 error. The thing is, I used to be able to upload 10 at once, each with only 1 resizing, and it'd work. So the timeout time must be more then 10 resizings, but less then 12 (11 eh? ).

So what I really need to do is figure out how to keep the script from throwing up the 500 error. I added "set_time_limit(0);" to the top of the uploading script and it still goes to the 500. I've also thrown that line in the function RIGHT before it starts going through each resizing, and no luck.

Does anyone know what I could do to make this work? It isn't a big deal right now, as I only have three new photos that need to go up, but if I ever run into a time when I have 30-40 new photos it will be hellish to upload them one at a time.




-------
I posted this in my server's help forums, but figured I might as well include it here incase anyone knows the answer...


Thanks a lo!
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

Warning, if you are using IIS:
Code: [ Select ]
php at mightycpa.com
26-Jun-2003 02:30
You may also need to look at Apache's timeout setting (Win32 version for me), I changed max execution time value in php.ini, and still got stopped by Apache's timeout value in the httpd.conf file.
rsallo at gna dot NOSPAM dot es
30-May-2003 05:28
When you are working with IIS, PHP timeout is valid only when it's lower than script timeout defined by IIS.

IIS 5 has a default timeout of 300 seconds. If you need a higher timeout, you also have to change IIS properties. Otherwise, your server will stop your PHP script before it reaches its own timeout.
  1. php at mightycpa.com
  2. 26-Jun-2003 02:30
  3. You may also need to look at Apache's timeout setting (Win32 version for me), I changed max execution time value in php.ini, and still got stopped by Apache's timeout value in the httpd.conf file.
  4. rsallo at gna dot NOSPAM dot es
  5. 30-May-2003 05:28
  6. When you are working with IIS, PHP timeout is valid only when it's lower than script timeout defined by IIS.
  7. IIS 5 has a default timeout of 300 seconds. If you need a higher timeout, you also have to change IIS properties. Otherwise, your server will stop your PHP script before it reaches its own timeout.


I have used set_time_limit() function over Apache+Linux without any problem.
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

yea I saw that comment, there is no way I can change the timeout through .htaccess thouhg :-?
  • _Leo_
  • Proficient
  • Proficient
  • User avatar
  • Posts: 279
  • Loc: Buenos Aires, Argentina

Post 3+ Months Ago

You may try adding this line to the htaccess:

Code: [ Select ]
 php_value max_execution_time "0"
  • stinger
  • Graduate
  • Graduate
  • stinger
  • Posts: 157
  • Loc: San Jose, CA

Post 3+ Months Ago

I don't understand????. . . . .

ARe you resizing the image and saving that new size ?. . . or are you resizing images to display as thumbnails?

I don't see the need for a timeout function.

Also, why are you resizing your images sooo many times?

I use a pre-made php thumbnail script that resizes images to a defined width or height and matches proportions. It runs 1 time on the images, and my thumbnails look great regardless of the original size.

Please educate me.
  • phpSelectah
  • Student
  • Student
  • User avatar
  • Posts: 97

Post 3+ Months Ago

Some configs dont allow .htaccess overrides, so your set_timeout() call may be in vain.

I think you are having timeout issues because of the amount of times you are resizing. I think it would be most efficient to resize once per pic, but if that dosn't fit what you ned, talk to the server admin and see if he can allow you to turn off his server timeout settings for your virtual host.

:D Good luck....
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

Sorry for the delay..forgot I posted this!

I am resizing images multiple times, because unlike most people I view at 1600x1200, and I want people to be able to see the image fit their screen.

What happens is the image is uploaded, then a function makes the image resize for the next biggest size, and so on.

I was thinking I could somehow make it so it does like 4 resizings, then refreshes the page and does the remainder, or something like that.....

any more ideas?
  • nuclei
  • Graduate
  • Graduate
  • User avatar
  • Posts: 147
  • Loc: On a mountain

Post 3+ Months Ago

why not set a line in a mysql table when they upload an image with the images path, etc, then a scheduled script could actually do the resizing in the background later.

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 57 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.