public function asidoResizeImg($args = array(), $crop = false) { asido::driver('gd'); $source_image = $args["source_image"]; $target_image = $args["target_image"]; $width = $args["width"]; $height = $args["height"]; // process crop images $i1 = asido::image($source_image, $target_image); // fit and add white frame if ($crop) { $x = $args["x"]; $y = $args["y"]; Asido::crop($i1, $x, $y, $width, $height); } else { Asido::frame($i1, $width, $height, Asido::Color(255, 255, 255)); } $i1->Save(ASIDO_OVERWRITE_ENABLED); }
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']; }
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']; }
* * This example shows how to do a custom rotate by 30 degrees, and we are * filling the blank areas left by the rotate with a nice green color. * * @filesource * @package Asido.Examples * @subpackage Asido.Examples.Rotate */ ///////////////////////////////////////////////////////////////////////////// /** * 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_02.png'); /** * Rotates the image by 30 degrees */ Asido::Rotate($i1, 30, Asido::Color(39, 107, 20)); /** * Save the result */ $i1->save(ASIDO_OVERWRITE_ENABLED); /////////////////////////////////////////////////////////////////////////////
* "white" is used to fill the blank areas. This is very handy when you want all * the resulting images to fit inside some frame without stretching them if the * proportions of the image and the frame do not match * * @filesource * @package Asido.Examples * @subpackage Asido.Examples.Resize */ ///////////////////////////////////////////////////////////////////////////// /** * 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_05.png'); /** * Resize the image by putting it inside a square frame (300x300) with `rgb(177,77,37)` as background. */ Asido::Frame($i1, 300, 300, Asido::Color(39, 107, 20)); /** * Save the result */ $i1->Save(ASIDO_OVERWRITE_ENABLED); /////////////////////////////////////////////////////////////////////////////