function asidoImg($arr) { include dirname(__FILE__) . '/../Util/asido/class.asido.php'; asido::driver('gd'); $height = $arr['height']; $width = $arr['width']; $x = $arr['x']; $y = $arr['y']; // process $i1 = asido::image($arr['temp_uploadfile'], $arr['new_uploadfile']); // fit and add white frame if ($arr['thumb'] === true) { Asido::Crop($i1, $x, $y, $width, $height); } else { // rotate the image if it is portrait // switch($arr['orientation']) // { // case 1: // nothing // break; // case 2: // horizontal flip // break; // case 3: // 180 rotate left // Asido::Rotate($i1,180); // break; // case 4: // vertical flip // break; // case 5: // vertical flip + 90 rotate right // break; // case 6: // 90 rotate right // Asido::Rotate($i1,90); // break; // case 7: // horizontal flip + 90 rotate right // break; // case 8: // 90 rotate left // Asido::Rotate($i1,-90); // break; // } Asido::Frame($i1, $width, $height, Asido::Color($arr['canvasbg']['r'], $arr['canvasbg']['b'], $arr['canvasbg']['g'])); } // always convert to jpg Asido::convert($i1, 'image/jpg'); $i1->Save(ASIDO_OVERWRITE_ENABLED); $data = array('photo' => $arr['web_file']); // echo $user_id; // delete old file echo $data['photo']; }
function asidoImg($arr) { asido::driver('gd'); $height = $arr['height']; $width = $arr['width']; $x = $arr['x']; $y = $arr['y']; // process $i1 = asido::image($_SERVER["DOCUMENT_ROOT"] . trim($arr['temp_uploadfile']), $_SERVER["DOCUMENT_ROOT"] . trim($arr['new_uploadfile'])); // fit and add white frame if ($arr['thumb'] === true) { Asido::Crop($i1, $x, $y, $width, $height); } else { Asido::Frame($i1, $width, $height, Asido::Color(255, 255, 255)); } // always convert to jpg Asido::convert($i1, 'image/jpg'); $i1->Save(ASIDO_OVERWRITE_ENABLED); $data = array('photo' => $arr['new_uploadfile']); // echo $user_id; // delete old file return $data['photo'] . "|" . $width . "|" . $height; }
function asidoImg($arr) { include 'asido/class.asido.php'; asido::driver('gd'); $height = $arr['height']; $width = $arr['width']; $x = $arr['x']; $y = $arr['y']; // process $i1 = asido::image($arr['temp_uploadfile'], $arr['new_uploadfile']); // fit and add white frame if ($arr['thumb'] === true) { Asido::Crop($i1, $x, $y, $width, $height); } else { Asido::Frame($i1, $width, $height, Asido::Color(255, 255, 255)); } // always convert to jpg Asido::convert($i1, 'image/jpg'); $i1->Save(ASIDO_OVERWRITE_ENABLED); $data = array('photo' => $arr['new_uploadfile']); // echo $user_id; // delete old file echo $data['photo']; }
* Crop Example #01 * * This example shows ... * * @filesource * @package Asido.Examples * @subpackage Asido.Examples.Crop */ ///////////////////////////////////////////////////////////////////////////// /** * Include the main Asido class */ include './../../class.asido.php'; /** * Set the correct driver: this depends on your local environment */ asido::driver('gd'); /** * Create an Asido_Image object and provide the name of the source * image, and the name with which you want to save the file */ $i1 = asido::image('example.png', 'result_01.jpg'); /** * Crop a portion of the image from the upper left corner */ Asido::Crop($i1, 0, 0, 300, 300); /** * Save the result */ $i1->save(ASIDO_OVERWRITE_ENABLED); /////////////////////////////////////////////////////////////////////////////