Forum Moderators: coopster
values altered via .htaccess:
max_input_time 300 (master 60)
memory_limit 64M (master 32M)
post_max_size 20M (master 8M)
upload_max_filesize 10M (master 2M)
This client wanted to increase max file uploads to 10M, the above values had worked but one tester was getting a white screen at imagecreatefromjpg() (or gif, or png) when the programming resizes the images.
I understand the why. I upped the memory limit and that has solved it for now, but this seems to be an excessive and sloppy use of memory.
The question: is there anything we can do to optimize the image resizing using the GD toolkit? I know about ImageMagick and use it often in perl; I would rather not recompile PHP, but if we must, we must. We should probably upgrade PHP anyway.
Using an aggressive internal logging combined with memory_get_usage() to measure things throughout program execution, it averages under 50K with a few spikes to a few hundred K all except in image resizing.
Corollary, but not as important: I'm not real comfortable with the above, futzing around with PHP's defaults (there is a reason for these, and I've found some of them via the GD toolkit.) I've explored the ftp methods and can't seem to locate a viable method to use FTP for a web-based upload interface. That too, seems like a better solution but you need an ftp client to FTP from . . . got suggestions?
I understand the why.
Then these won't help much, but for other readers it may come in handy ...
More PHP image upload problems [webmasterworld.com]
Uploading big images turn to black! [webmasterworld.com]
FTP is the recommended method
Recommended by ... ? If you aren't opposed to opening that door to your client than I suppose you could have them download a copy of FileZilla and open an FTP port for them. Personally, I wouldn't, but that's me. Not unless they are using secure FTP. Even so, you are then opening that port on your server to be poked at all day long. So do you then give them a VPN tunnel? I don't like any of those options myself. I would stick to secure login and file upload via http.
Recommended by ... ?
<blushes> Ten or twelve search results, message boards, articles, to the effect that if you exceed the PHP defaults, you should be using ftp methods instead of stock file upload methods.
I read those two threads, hadn't found them before, thank you . . . however it reiterates a lot of the info I'd already found (i.e., GD toolkit can be a memory hog with larger images.)
I agree w. both, just limit the file sizes and be done with it . . . but one of the client requirements in the revision was to up the maximum upload size.
All in all, it looks like I'm off to get my admin to upgrade PHP and recompile it with ImageMagick support, which (to my understanding) spawns the image manipulation in a separate process and uses a lot less memory.