I have the following script that works fine with uploadify, What i would like to do, is take that uploaded image, and ideally use the imagejpeg(name, null, quality) feature so i can experiment with how the file size changes. however I just cant get it to work. I keep getting the "imagejpeg(): supplied argument is not a valid Image resource" error. Anyway, here is my code - thanks in advance.
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
//Make our unique file name token_time_orgfilename
$targetFile = str_replace('//','/',$targetPath) . $token . "_" . time() . "_" . $_FILES['Filedata']['name'];
//name it without all the complete URL
$fileName = $token . "_" . time() . "_" . $_FILES['Filedata']['name'];
if(!file_exists($targetPath)) {
mkdir($targetPath, 0755, true);
}
move_uploaded_file($tempFile,$targetFile);
echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$fileName);
imagejpeg is is used to output (to the browser or save on disk) the image and that is something that you need to do at the end of your resize script. you must start by creating a gd resource using a function like http://php.net/imagecreatefromjpeg to which you must provide the path to the uploaded file. if you did, you should give us the code to your resize script.