Reply to Resizing existing images

Resizing existing images new!
by Mack, 15 years, 4 months ago
What I am trying to do I know the class wasn't designed for. I want to resize an image that already exist on our server and replace it with no renaming. I tried a lot of different combinations but it just doesn't want to work.

The code below is bad, but as it stands now, it keeps throwing me an error looking for the tmp file to unlink.
while($rowgames = $querygames->fetchRow()){
  $handle = new upload(GAMEPATH.stripslashes($rowgames['gimage']));
  $handle->no_upload_check;
  if($handle->uploaded){
    $handle->file_new_name_body   = str_replace('.png', '', stripslashes($rowgames['gimage']));
    $handle->image_resize         = true;
    $handle->image_x              = GAMESIZEWIDTH;
    $handle->image_ratio_y        = true;
    $handle->image_y              = GAMESIZEHEIGHT;
    $handle->image_ratio_x        = true;
    $handle->image_convert = 'png';
    $handle->process(GAMEPATH);
    if ($handle->processed) {
      $querygames2 = "UPDATE ".TABLE_GAMES." SET gimage = ".$mdb->escape($handle->file_dst_name)." WHERE cgid = '".intval($rowgames['cgid'])."'";
      $mdb->exec($querygames2);
      $handle->clean();
      //unlink(GAMEPATH.stripslashes($rowgames['gimage']));
    }
  } else {
    echo 'error : ' . $handle->error .'';
    echo $rowgames['gimage'];
    die();
  }
  $handle->clean();
}
Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important