| [ PHPXref.com ] | [ Generated: Sun Jul 20 20:24:47 2008 ] | [ Snipe Gallery 3.1.4 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * crop.php 4 * 5 * This file handles the cropping for both fullsize and thumbnail 6 * images when using the cropping tool. This file also calls up the watermark 7 * function if appropriate. The actual crop tool interface is located in 8 * the /lib/croptool.php file 9 * 10 * @package admin 11 * @author A Gianotto <snipe@snipe.net> 12 * @version 3.0 13 * @since 3.0 14 * 15 */ 16 17 /** 18 * 19 * {@source } 20 */ 21 22 $GALLERY_SECTION = "image"; 23 $PAGE_TITLE = "Crop Tool"; 24 25 26 include ("../../inc/config.php"); 27 include ($cfg_admin_path."/lib/connect.php"); 28 include ($cfg_admin_path."/lib/admin.functions.php"); 29 include ($cfg_admin_path."/lib/dropdown.functions.php"); 30 31 include ("../layout/admin.header.php"); 32 33 // get the category details 34 if (!empty($_REQUEST['gallery_id'])) { 35 $sql = "select name, default_thumbtype, watermark_txt from snipe_gallery_cat where id='".$_REQUEST['gallery_id']."'"; 36 if ($get_catname = mysql_query($sql)) { 37 $valid_cat = mysql_num_rows($get_catname); 38 if ($valid_cat > 0) { 39 list($this_catname, $this_thumbtype, $this_watermark_txt) = mysql_fetch_row($get_catname); 40 } 41 } 42 } 43 44 if (!empty($_REQUEST['image_id'])) { 45 46 47 48 $sql = "select filename, cat_id from snipe_gallery_data where id='".$_REQUEST['image_id']."'"; 49 if ($get_filename = mysql_query($sql)) { 50 $valid_image = mysql_num_rows($get_filename); 51 if ($valid_image > 0) { 52 list($image_filename, $gallery_id) = mysql_fetch_row($get_filename); 53 54 if (($_REQUEST['crop']==1) && (isset($_REQUEST['sx'])) && (isset($_REQUEST['sy'])) && (isset($_REQUEST['ex'])) && (isset($_REQUEST['ey']))) { 55 56 $uploaded_img_size = getimagesize($cfg_pics_path."/".$image_filename); 57 58 if ((isset($this_thumbtype)) && (($uploaded_img_size[2]==2) || ($uploaded_img_size[2]==2)) && ($_REQUEST['croptype']=="full")) { 59 60 61 cropImage($image_filename, $_REQUEST['sx'], $_REQUEST['sy'],$_REQUEST['ex'],$_REQUEST['ey'], 0); 62 63 if (trim($this_watermark_txt)!="") { 64 cropImage($image_filename, $_REQUEST['sx'], $_REQUEST['sy'],$_REQUEST['ex'],$_REQUEST['ey'], 1); 65 66 $text_length = (strlen($this_watermark_txt) * 6); 67 if (($uploaded_img_size[0] - $cfg_font_h_padding) > $text_length){ 68 watermark_img($image_filename, $this_watermark_txt, $cfg_font_size); 69 } 70 71 } 72 73 } else { 74 75 cropImage($image_filename, $_REQUEST['sx'], $_REQUEST['sy'],$_REQUEST['ex'],$_REQUEST['ey'], 1); 76 } 77 78 79 80 if ($_REQUEST['croptype']!="full") { 81 $sql = "update snipe_gallery_data set thumbname='".$image_filename."' where id='".$_REQUEST['image_id']."'"; 82 } 83 84 85 if ($update_img = mysql_query($sql)) { 86 if ($_REQUEST['croptype']=="full") { 87 echo "<h3>".$LANG_ADMIN_IMG_CROPPED."</h3>"; 88 echo "<p>".$LANG_ADMIN_IMG_CROPPED_TXT ."</p>"; 89 echo '<img src="'.$cfg_pics_url.'/'.$image_filename.'?'.date("U").'">'; 90 } else { 91 echo "<h3>".$LANG_ADMIN_THUMB_ACCEPT."</h3>"; 92 echo "<p>".$LANG_ADMIN_THUMB_ACCEPT_TXT."</p>"; 93 $size = getimagesize($cfg_thumb_url.'/'.$image_filename); 94 echo '<img src="'.$cfg_thumb_url.'/'.$image_filename.'?'.date("U").'">'; 95 } 96 97 } else { 98 echo "error"; 99 } 100 } else { 101 if ($_REQUEST['croptype']=="full") { 102 echo "<h3>".$LANG_SUBNAV_EDIT_IMG.": ".$LANG_ADMIN_CROP_IMG."</h3>\n\n"; 103 echo "<p>".$LANG_ADMIN_CROP_TXT."</p>"; 104 } else { 105 echo "<h3>".$LANG_SUBNAV_EDIT_IMG.": ".$LANG_ADMIN_SEL_THUMB."</h3>\n\n"; 106 echo "<p>".$LANG_ADMIN_SEL_THUMB_TXT."</p>"; 107 108 } 109 110 $image_size = getimagesize($cfg_pics_path.'/'.$image_filename); 111 $img_width = $image_size[0]; 112 $img_height= $image_size[1]; 113 $show_crop_js = 1; 114 115 include ($cfg_admin_path."/lib/croptool.php"); 116 } 117 } else { 118 echo "<p>".$LANG_ERR_ERROR ." - ".$LANG_ERR_INVALID_IMAGEID_HEAD."</p>"; 119 } 120 } else { 121 echo "<p class=\"errortxt\">".$LANG_ERR_DB_ERROR."</p>"; 122 if ($cfg_debug_on==1) { 123 echo "<p><b>mySQL said: </b>"; 124 echo mysql_error(); 125 echo "</p>\n\n<p><b>SQL query:</b> $sql </p>"; 126 127 } 128 } 129 130 131 132 133 134 } else { 135 echo "<h3>".$LANG_ERR_NOIMAGE_HEAD."</h3>\n\n"; 136 echo "<p>".$LANG_ERR_NOIMAGE_CROP." </p>"; 137 } 138 139 140 include ("../layout/admin.footer.php"); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |