plug
Well-Known Member
this is probably more to do with the server on which this script is running that the script itself, as I developed and tested it locally without problems... anyway it's wrecking my head something stupid.
I created a couple of classes to handle the validation, upload and resize of images.
the validator works fine; it takes a _FILES array and validates a few things including the mime type of the image. all valid images are added to an array that gets passed to an uploader.
the uploader is grand as well; it accepts the array of valid images, creates a folder (and a database entry for that folder) and uploads the image files from the temp dir to the newly created dir. all fine here too.
resizing... here's where the problem occurs. but only and a specific point and under certain conditions. say the image is a jpeg (already fully validated)... the problem will occur when using the function imagecreatefromjpeg(), which accepts a reference to an image and returns an image identifier, which can then be used for resizing etc. I need to put a try/catch block here but anyway, this is where my script fails, but ONLY (based on some testing) if the physical file dimensions are over 2000x1500. it seems to have nothing to do with filesize, although I'm not positive yet. as I mentioned before, this is only happening on the server that I've uploaded to, not the local version which seems to accept all sizes without issue. I'm going to run a test on a different server as well, just to see what's going on. I must try and see what version of the gd library they're running on the server too.
the problem with this is, I need this script to be able to handle large images. so this isn't good news. has anyone any ideas, or have they come across this kind of thing before?????
I created a couple of classes to handle the validation, upload and resize of images.
the validator works fine; it takes a _FILES array and validates a few things including the mime type of the image. all valid images are added to an array that gets passed to an uploader.
the uploader is grand as well; it accepts the array of valid images, creates a folder (and a database entry for that folder) and uploads the image files from the temp dir to the newly created dir. all fine here too.
resizing... here's where the problem occurs. but only and a specific point and under certain conditions. say the image is a jpeg (already fully validated)... the problem will occur when using the function imagecreatefromjpeg(), which accepts a reference to an image and returns an image identifier, which can then be used for resizing etc. I need to put a try/catch block here but anyway, this is where my script fails, but ONLY (based on some testing) if the physical file dimensions are over 2000x1500. it seems to have nothing to do with filesize, although I'm not positive yet. as I mentioned before, this is only happening on the server that I've uploaded to, not the local version which seems to accept all sizes without issue. I'm going to run a test on a different server as well, just to see what's going on. I must try and see what version of the gd library they're running on the server too.
the problem with this is, I need this script to be able to handle large images. so this isn't good news. has anyone any ideas, or have they come across this kind of thing before?????