This plugin includes several image related functions. You can modify an image (resize, crop, scale), get information (dimensions, type & file size), or automatically create a display or a list of all images in a given directory. Most of the classes require that GD be enabled in PHP , otherwise there’s not any special requirements. The examples on this page are using static images, and the returned data simulated as CodeCanyon obviously doesn’t allow running PHP scripts on this page. Visit the example page to see the images actually being modified on the fly.
Image Info
This will return basic info about a specific image including image type, width, height and size (in bytes, kilobytes and megabytes).
echo $image->info("img/swirly.png");
RESULT
- Image type: png
- Width: 1920
- Height: 1280
- Size in bytes: 1285926
- Size in kilobytes: 1285.93
- Size in megabytes: 1.29
Image Scale
The function will scale an image proprtionally to a specific width. Example resizes 1920×1280 image to 300 pixels wide.
$image->scale("img/swirly.png", $dest="img/scale.png", $width=300);
RESULT
Image Resize
The function will resize an image to a specific width and height (may not be proportional). Example resizes 1920×1280 image to 200×300.
$image->resize("img/swirly.png", $dest="img/resize.png", $width=200, $height300);
PHP Image Plugin
Không có nhận xét nào:
Đăng nhận xét