getFile($file_id); $file->scaleCrop($scale_crop_default_width, $scale_crop_default_height); $file->op('stretch/off'); $file->store(); } if ($_GET['file_id']) { $file_id = $_GET['file_id']; $file = $api->getFile($file_id); $file->scaleCrop($scale_crop_default_width, $scale_crop_default_height); $file->op('stretch/off'); $file->store(); } $is_insert = false; $is_preview = false; if ($_POST['insert'] or $_POST['_preview']) { $file_id = $_POST['file_id']; $file = $api->getFile($file_id); $original = clone $file; if (isset($_POST['crop'])) { $crop_width = $_POST['crop_width']; $crop_height = $_POST['crop_height']; $crop_center = isset($_POST['crop_center']) ? true : false; $crop_fill_color = $_POST['crop_fill_color']; $file = $file->crop($crop_width, $crop_height, $crop_center, $crop_fill_color); } if (isset($_POST['resize'])) { $resize_width = $_POST['resize_width']; $resize_height = $_POST['resize_height']; $file = $file->resize($resize_width, $resize_height); } if (isset($_POST['scale_crop'])) { $scale_crop_width = $_POST['scale_crop_width']; $scale_crop_height = $_POST['scale_crop_height']; $scale_crop_center = isset($_POST['scale_crop_center']) ? true : false; $file = $file->scaleCrop($scale_crop_width, $scale_crop_height, $scale_crop_center); } else { $scale_crop_width = $scale_crop_default_width; $scale_crop_height = $scale_crop_default_height; $scale_crop_center = false; } if (isset($_POST['effect_flip'])) { $file = $file->effect('flip'); } if (isset($_POST['effect_grayscale'])) { $file = $file->effect('grayscale'); } if (isset($_POST['effect_invert'])) { $file = $file->effect('invert'); } if (isset($_POST['effect_mirror'])) { $file = $file->effect('mirror'); } if (isset($_POST['stretch_off'])) { $file->op('stretch/off'); } $is_insert = true; if ($_POST['_preview']) { $is_insert = false; $is_preview = true; } } ?>