Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Problem with rescaling images

images php coding issues or problems here.

Moderators: macek, egami, gesf

Problem with rescaling images

Postby RubenCoolen » Thu Jan 19, 2012 10:26 am


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
$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);
         echo "uploaded";
New php-forum User
New php-forum User
Posts: 1
Joined: Thu Jan 19, 2012 10:25 am

Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.