if ($cropStart) { $cropStartArray = explode(',', $cropStart); Asido::crop($img, $cropStartArray[0], $cropStartArray[1], $previewWidth, $previewHeight); } else { Asido::crop($img, 0, 0, $previewWidth, $previewHeight); } } } Asido::resize($img, $previewWidth, $previewHeight, ASIDO_RESIZE_STRETCH); } else { if (strstr($convertImage, 'rotate')) { $rotateAttrs = explode(':', $convertImage); if (!$rotateAttrs[1]) { $rotateAttrs[1] = 90; } Asido::Rotate($img, $rotateAttrs[1]); } else { if (!$previewWidth) { Asido::height($img, $previewHeight); } else { if (!$previewHeight) { Asido::width($img, $previewWidth); } else { Asido::resize($img, $previewWidth, $previewHeight, ASIDO_RESIZE_STRETCH); } } } } } $img->save(ASIDO_OVERWRITE_ENABLED); }
* Rotate Example #01 * * This example shows how to rotate an image by 90 degrees. * * @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_01.png'); /** * Rotates the image by 90 degrees */ Asido::Rotate($i1, 90); /** * Save the result */ $i1->save(ASIDO_OVERWRITE_ENABLED); /////////////////////////////////////////////////////////////////////////////
* * 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); /////////////////////////////////////////////////////////////////////////////