I am using a php script to upload a jpeg file and then resize it to something smaller. When I test the code locally it works great and I end up with the uploaded file and reduced file. But when trying to test this from my local machine and uploading to my server I get a error. But the first file I upload before resizing uploads fine? the creation of this second file is causing a problem?
Here is the code that I use to save the resized version
It's writing to the exact same folder. There were a few work arounds that I found on the web like writing to a buffer first ob_start() to using an fopen and fclose to create the file to write to but nothing worked. When I created a file using fopen it created the file but it was 0K and I still get the error above?
any ideas?
Code:
Warning: imagejpeg() [function.imagejpeg]: Unable to open 'ftp://user:pass@mySite/public_html/somefolder/test/images/photos/photo9.jpg' for writing: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/upload_test.php on line 219
OK
Here is the code that I use to save the resized version
Code:
$src = imagecreatefromjpeg($imageToResize);
if($src == false) {
$error = "Unknown problem trying to open uploaded image.";
return false;
}
$resizedImage = imagecreatetruecolor(320, 213);
imagecopyresampled($resizedImage, $src, 0, 0, $removeAmount, 0, 320, 213, $width, $height);
$toTouch = "ftp://user:pass@mysite.com/public_html/somefolder/test/images/photos/photo9.jpg";
//$toTouch = "uploads/photo15.jpg"; // I use this to test my local storage
[B]imagejpeg($resizedImage,$toTouch, 100);[/B]
mageDestroy($resizedImage);
It's writing to the exact same folder. There were a few work arounds that I found on the web like writing to a buffer first ob_start() to using an fopen and fclose to create the file to write to but nothing worked. When I created a file using fopen it created the file but it was 0K and I still get the error above?
any ideas?