cropimage_resize( $CropImg['PATH'], $_POST['x'], $_POST['y'], $_POST['x2'], $_POST['y2'], $_POST['w'], $_POST['h'] ); $img->destroy(); $query=' SELECT id, path, representative_ext FROM '.IMAGES_TABLE.' WHERE id = '.(int)$_POST['image_id'].' ;'; $row = pwg_db_fetch_assoc(pwg_query($query)); if ($row == null) { return false; } sync_metadata(array($row['id'])); $query = 'UPDATE '.IMAGES_TABLE .' SET coi=NULL WHERE id='.$row['id']; pwg_query($query); delete_element_derivatives($row); $_SESSION['page_infos'][] = l10n('Photo Cropped'); redirect($admin_photo_base_url); } // +-----------------------------------------------------------------------+ // | Tabs | // +-----------------------------------------------------------------------+ $tabsheet = new tabsheet(); $tabsheet->set_id('photo'); $tabsheet->select('crop'); $tabsheet->assign(); // +-----------------------------------------------------------------------+ // | template init | // +-----------------------------------------------------------------------+ $template->set_filenames( array( 'plugin_admin_content' => dirname(__FILE__).'/crop_image.tpl' ) ); // get picture from gallery if (isset($_GET['image_id'])) { $query = ' SELECT file, path, coi, width, height, name FROM '.IMAGES_TABLE.' WHERE id = '. (int)@$_GET['image_id'] .' ;'; $result = pwg_query($query); if (!pwg_db_num_rows($result)) { array_push($page['errors'], l10n('Unknown Photo ID')); } else { $picture = pwg_db_fetch_assoc(pwg_query($query)); $picture['filename'] = basename($picture['path']); $picture['banner_src'] = PHPWG_ROOT_PATH . $picture['path']; list($RatioWidth, $RatioHeight) = getimagesize($picture['path']); $template->assign(array( 'TITLE' => render_element_name($picture), 'IN_CROP' => true, 'picture' => $picture, 'crop' => get_crop_display($picture), 'image_id' => (int)@$_GET['image_id'], 'image_ratio' => $RatioWidth/$RatioHeight, )); } } // +-----------------------------------------------------------------------+ // | sending html code | // +-----------------------------------------------------------------------+ $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); ?>