System:Thumbnail
From Aspen Documentation
For full public method documentation, see the API Manual.
The Thumbnail class may be used with images on the server, whether they've been uploaded or existed previously doesn't matter, as long as the web server has read access to the original, and write access to the modified version.
This class is not enabled by default, though it is provided with the default distribution of the framework. To enable it, just copy the following code to either of your user configuration files:
$config['load_add_core_class'][] = array('classname' => 'Thumbnail', 'autoload' => false);
You must have the GD library installed on your server in order for the class to work.
It's as easy as creating a new instance of the class, providing the file path, sizes, and saving it back. The thumbnail class in not instantiated by Aspen automatically, since we need to provide the file path to the class as we open it.
$thm_create = new Thumbnail('path/to/file.jpg'); $thm_create->resize(330,250); $thm_create->save('path/to/newfile.jpg');
The first line creates a new instance of the class. We use the resize function to provide a maximum width, and height of the image.
Check out the API Manual for information on using the other resize and cropping functions.
Once complete, you have the option to either show or save the resized image. In this example we save it back to the file system, so we need to provide a new path.