I’m currently allowing users to upload an img and then I save the image as folows:
$tmp = imagecreatetruecolor($configWidth, $configHeight);
imagecopyresampled($tmp, $src, 0,0,0,0,$configWidth,$configHeight,$origWidth,$origHeight);
imagejpeg($tmp, $_SERVER['DOCUMENT_ROOT'].$folder.$newFileName,90);
I then show the image to the user so they can crop the image.
I wanted to ask if I could display the image for cropping without saving it – eg: could I show the image to the user for cropping from the tmp_name – the tmp php image?
I’m not sure if this is possible but it would avoid having to save an image that is then later deleted post cropping…
thx
No the image is outside the webroot also the image will be deleted when the upload script finishes execution.
With some html5 methods you can show an image on a page without uploading it. see https://developer.mozilla.org/en-US/docs/DOM/FileReader#Example