Download the PHP package marcha/imagecow without Composer
On this page you can find all versions of the php package marcha/imagecow. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marcha/imagecow
More information about marcha/imagecow
Files in marcha/imagecow
Package imagecow
Short Description PHP library to manipulate and generate responsive images
License MIT
Homepage https://github.com/oscarotero/imagecow/
Informations about the package imagecow
Imagecow
Created by Oscar Otero http://oscarotero.com [email protected]
What is Imagecow?
It's a php library to manipulate images to web.
- Written in PHP 5.3
- Use GD2 or Imagick libraries (and can be extended with more)
- Has an optional client-side javascript to generate responsive images
- Very simple and easy to use. There is not a lot of features, just only the basics: crop, resize, resizeCrop, etc.
- Use the PSR-4 autoloader standard
Notes on 1.x version
The API in 1.x version changes a little bit (not much, only on create the instances).
How use it?
Use the static function Imagecow\Image::create() to load an image and returns an imageCow instance. This function has two arguments:
- image: The image file path or a binary string with the image data
- library: The library used (Gd or Imagick). If it's not provided, it's detected automatically (in order of preference: Imagick, Gd)
Crop the image
Resize the image
Resize and Crop the image
Rotate
Convert the image to other formats:
Save the image to a file
Execute multiple functions (resize, crop, resizeCrop, format)
This is useful to get images transformed dinamically using get variables: image.php?transform=resize,200,300|format,png
Show the image
Other functions:
Responsive images
Include the Imagecow.js library in the html page and execute the function Imagecow.init();
This function saves a cookie with the client information (width, height, connection speed). You can configurate the cookie. The default values are:
In the server-side, use the cookie to generate the responsive operations:
Now you can transform the image according with the client dimmensions. The available options are:
- max-width
- min-width
- max-height
- min-height
- width
- height
You can use the same syntax than transform, but separate the "media-query" with ";".
Get me the image "my_picture.png" with resizeCrop to 800x600. If the max-width of the client side is 400, resize to 400.
Usage in PHP frameworks
For Laravel and PHP FuelPHP users you can use the wrapper by @kevbaldwyn: https://github.com/kevbaldwyn/image/
Other utils
IconExtractor. Class to extract the images from an .ico file and convert to png. Only for Imagick:
SvgExtractor. This class allows generate images from a svg file (usefull for browsers that don't support svg format):
Maintainers:
- @oscarotero (creator)
- @eusonlito (contributor)
- @AndreasHeiberg (contributor)
- @kevbaldwyn (contributor)