I got a little problem with my uploadscript. I want it to send the uploaded image in its original format and size to the map images/other/tmp first, which it does correctly. Then it should make 2 scaled copies via a class. I tested the class in a seperate page and it should work. Afterwards it should delete the tmp file. The problem I am having is that the rescaling does not work, and it does not delete my file. It also does not give any errors at all.
Any help would be greatly appreciated.
- Code: Select all
<?php
$target_path = "images/other/tmp/";
$target_path = "$target_path".$itemid."_".time()."_".basename($_FILES['image1']['name']);
$thumb_path = "images/other/thumbs/";
$thumb_path = "$target_path".$itemid."_".time()."_".basename($_FILES['image1']['name']);
$scaled_path = "images/other/scaled/";
$scaled_path = "$target_path".$itemid."_".time()."_".basename($_FILES['image1']['name']);
if(move_uploaded_file($_FILES['image1']['tmp_name'], $target_path)) {
$resizeObj = new resize(realpath($target_path));
$resizeObj -> resizeImage(140, 140, 'auto');
$resizeObj -> saveImage($thumb_path, 100);
$resizeObj = new resize(realpath($target_path));
$resizeObj -> resizeImage(600, 600, 'auto');
$resizeObj -> saveImage($scaled_path, 100);
unlink($target_path);
echo "uploaded";
}
?>

