public function action_crop() { if (Request::initial()->is_ajax()) { $temp = new Cropper($this->request, $this->response); $data = $temp->create(); $crop = Model::factory('Photo'); $result = $crop->getPost($this->request->post('id'), $this->request->post('login')); if (empty($result)) { $crop->addPost($data['login'], $data['post_id'], $data['path']); } $temp = $crop->getPost($this->request->post('id'), $this->request->post('login')); $img["url"] = $temp[0]["path"]; $img["width"] = getimagesize($img["url"])[0]; $img["height"] = getimagesize($img["url"])[1]; echo json_encode($img); } else { $this->response->body('Internal server error'); } }
<?php error_reporting(E_ALL); ini_set("display_errors", 1); include 'images.php'; include 'config.php'; $images = []; for ($i = 0; $i < count($_FILES['images']['name']); $i++) { $temp = "temp/"; $temp = $temp . basename($_FILES['images']['name'][$i]); move_uploaded_file($_FILES['images']['tmp_name'][$i], $temp); array_push($images, $temp); } $cropper = new Cropper(); $directory = $cropper->crop($images); ?> <html> <head> <title> AppScreenshotSize.com | App Screenshot Resizer</title> <link rel="stylesheet" type="text/css" href="node_modules/milligram/dist/milligram.min.css"> </head> <body> <div class="container"> <div class="row"> <div class="column"> <h1> Resize Complete </h1> </div>
public function printCropperModal() { foreach ($this->croppermodals as $cp) { Cropper::createModal($cp->id, $cp->modal_title, $cp->InputToUpdate, $cp->value, $cp->ratio, $cp->imgIDToBeUpdated, $cp->onSuccessJS); } }
<?php error_reporting(E_ALL); function path($num = 0) { $path = explode('/', dirname(__FILE__)); for ($i = 0; $i < $num; $i++) { array_pop($path); } return implode("/", $path); } require_once path(1) . "/class/class.cropper.php"; try { $cropper = new Cropper($_POST['data']); $cropper->setPath(path(2) . "/upload/"); $cropper->generate(); echo $cropper->getName(); } catch (Exception $e) { echo $e->getMessage(); }