Jump to content

Upload large images and manipulate


deansatch

Recommended Posts

In the past, whenever I write an image upload script in php that needs to generate a thumbnail or resized version, I have had to make sure the image is a reasonable size before uploading otherwise you get the old 'allowed memory bytes exceeded' thing.

 

What are my options if I want people to be able to upload a full size image from their camera i.e. a 15-20mb 4000x3000px image and then have a thumbnail and something like 500px wide version for displaying on the site? The large unaltered original needs to be stored as well as it will be used for prints.

 

Is this just not possible with PHP? Or is it down to needing a dedicated server?

Link to comment
Share on other sites

well, i have never known of an image3000 x 4000px being 20MB, but i could be wrong.

anyway, their are a few php.ini directives that will need to be changed from their default values to be able to upload a file of that size.

 

post_max_size

upload_max_filesize

memory_limit (should never really need to change this one, if your code is written correctly and optimized)

 

Link to comment
Share on other sites

Photos can be large files straight from a pro 21mp camera. But the filesize isn't really that much of an issue, it's more to do with the processing. I.e. Uploading the image should work fine...but during the upload if my script runs imagecopyresampled a couple of times to create the 2 smaller images and then sticks a watermark on top, the script will fail. It's just too much going on.

 

So I suppose, back to my original question, what is the "proper" way to write it? Clearly it isn't the way I described above but I can't see another way?!?? Some sort of break sequence somehow? Where it runs each part separately at timed intervals?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.