0){ $result = db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = '$pid'"); $CURRENT_PIC = mysql_fetch_array($result); mysql_free_result($result); $pic_url = get_pic_url($CURRENT_PIC,'fullsize'); } //Garbage collection run at an probability of 25% and delete all files older than one hour if (rand(1,100) < 25){ $d = opendir(IMG_DIR); while ($file = readdir($d)){ if (is_file(IMG_DIR.$file) && ((time() - filemtime(IMG_DIR.$file))/60) > 60 && $file !="index.html" ){ @unlink(IMG_DIR.$file); } } } //Include the proper class for image Object if ($CONFIG['thumb_method']=="gd2"){ require("include/imageObjectGD.class.php"); }elseif ($CONFIG['thumb_method']=="im"){ require("include/imageObjectIM.class.php"); }else{ die ("Editor class for your resize method not implemented"); } //////////////////////////////////Main script////////////////////////////////////// // PREVENTING CACHING header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // HTTP/1.0 // PAGE INIT if (!$img_dir) $img_dir = IMG_DIR; if ($_GET['id']){ //Copy the Image file to the editing directory if (copy($CONFIG['fullpath'].$CURRENT_PIC['filepath'].$CURRENT_PIC['filename'],$img_dir.$CURRENT_PIC['filename'])) $newimage = $CURRENT_PIC['filename']; }else if(!isset($newimage)){ $newimage = $_POST['newimage']; } if ($newimage){ $imgObj = new imageObject($img_dir,$newimage); if ($_POST['quality']){ $imgObj->quality = $_POST['quality']; } if ($imgObj->imgRes){ if ($_POST['clipval'] && $_POST['cropping']==true){ $imgObj = $imgObj->cropImage($_POST['clipval']); } if ($_POST['angle']<>0){ $imgObj = $imgObj->rotateImage($_POST['angle']); } } $newimage = $imgObj->filename; }// newimage if(isset($_POST["save"])) { $width=$imgObj->width; $height=$imgObj->height; $normal = $CONFIG['fullpath'] . $CURRENT_PIC['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC['filename']; $thumbnail = $CONFIG['fullpath'] . $CURRENT_PIC['filepath'] . $CONFIG['thumb_pfx'] . $CURRENT_PIC['filename']; $filesize = @filesize($img_dir.$newimage); //Full image replace copy($img_dir.$newimage,$CONFIG['fullpath'].$CURRENT_PIC['filepath'].$CURRENT_PIC['filename']) ; // Normal image resized and replace, use the CPG resize method instead of the object resizeImage // as using the object resizeImage will make the final display of image to be a thumbnail in the editor if (max($width, $height) > $CONFIG['picture_width'] && $CONFIG['make_intermediate']) { resize_image($img_dir.$newimage, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']); } else { @unlink($normal); } //thumbnail resized and replace resize_image($img_dir.$newimage, $thumbnail, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']); $total_filesize = $filesize + (file_exists($normal) ? filesize($normal) : 0) + filesize($thumbnail); //Update the image size in the DB db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET pheight = $height, pwidth = $width, filesize = $filesize, total_filesize = $total_filesize WHERE pid = '$pid'"); $message = "Picture successfully saved - you can close this window now"; } if(isset($_POST["save_thumb"])) { $width=$imgObj->width; $height=$imgObj->height; $normal = $CONFIG['fullpath'] . $CURRENT_PIC['filepath'] . $CONFIG['normal_pfx'] . $CURRENT_PIC['filename']; $thumbnail = $CONFIG['fullpath'] . $CURRENT_PIC['filepath'] . $CONFIG['thumb_pfx'] . $CURRENT_PIC['filename']; $currentPic = $CONFIG['fullpath'] . $CURRENT_PIC['filepath'] . $CURRENT_PIC['filename']; //Calculate the thumbnail dimensions if ($CONFIG['thumb_use'] == 'ht') { $ratio = $height / $CONFIG['thumb_width'] ; } elseif ($CONFIG['thumb_use'] == 'wd') { $ratio = $width / $CONFIG['thumb_width'] ; } else { $ratio = max($width, $height) / $CONFIG['thumb_width'] ; } $ratio = max($ratio, 1.0); $dstWidth = (int)($width / $ratio); $dstHeight = (int)($height / $ratio); $imgObj->quality = (int)($_POST['quality']); $imgObj = $imgObj->resizeImage($dstWidth,$dstHeight); $newimage = $imgObj->filename; copy($img_dir.$newimage,$CONFIG['fullpath'].$CURRENT_PIC['filepath'].$CONFIG['thumb_pfx'].$CURRENT_PIC['filename']) ; $total_filesize = filesize($currentPic) + (file_exists($normal) ? filesize($normal) : 0) + filesize($thumbnail); //Update the image size in the DB db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET total_filesize = $total_filesize WHERE pid = '$pid'"); $message = "Thumbnail successfully saved - you can close this window now"; } ?> <?php echo $lang_editpics_php['crop_title'] ?> >
Enable clipping, apply to crop

string; ?> align="absmiddle">