Download the PHP package falmar/eimage without Composer
On this page you can find all versions of the php package falmar/eimage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download falmar/eimage
More information about falmar/eimage
Files in falmar/eimage
Informations about the package eimage
eImage - Image upload, resize and crop!
eImage it's a simple PHP Class to make Uploading and Editing Images even more easy!
A rewrite of a old Class (_image) originally written by Mark Jackson (mjdigital) all credits of main idea goes to him :D
Major changes from the original class:
- Used all available PSR (Autoload, CodeStyle, etc...)
- Added Exception to handle errors
- Reduced portions of code by putting them into general class methods
- Removed obsolete|unused methods|conditions|variables
Requirements
- PHP >= 5.4
Examples
Upload Image
NOTE: If there is not an extension specified in 'NewName' parameter it will take the extension from the original image. NOTE2: You can specify a new extension with NewExtension property
Crop Image
NOTE: if you do not specify a NewName or Prefix parameter the original image will be override by the new crop method. You can also set the Duplicates to 'u' unique to create a new image instead of override
Resize Image
NOTE: You may want to specify resize properties such as AspectRatio, Oversize, ScaleUp according to your needs.
Parameters and their default values
NewName
Specify the new name for your image.
UploadTo
Specify where the new image is going to be uploaded to.
ReturnType
- 'full_path': string with the full path to the new image.
- 'bool': true or false if the upload succeeded.
- 'array':
- from upload() method: Pretty close to the array it will return name, path, size, tmp_name and full_path.
- from crop() method: Will return name, prefix, path, height, width and full_path.
- from resize() method: Will return name, prefix, path, height, width, pad_color and full_path.
SafeRename
- true: will clean the image name and remove strange characters.
- false: the new image will contain the same name as the uploaded image.
Duplicates
If a there is an existing file:
- 'o': Overwrite the file.
- 'u': Create an unique file.
- 'e': Throw eImageException.
EnabledMIMEs
An array that contain the MIME Types the eImage Class will be allow to upload.
DisabledMIMEs
If this property is set with values it will forbid to upload the MIME Types or Extensions specified.
NOTE: Any other MIME Type or Extension THAT IS NOT SET HERE will be allowed to upload.
Source
Full path to a file automatically set after image upload for easy access resize and crop methods.
CreateDir
If set to true create a directory if not exist (UploadTo | NewPath).
ImageQuality
Integer [1-100]%.
NewExtension
Apply a new extension to the image (.jpg, .png, .gif).
Prefix
Specify a new prefix for the image.
NewPath
Specify path for the new image, it apply only for crop() and resize() methods.
AspectRatio
Set true or false if you want to maintain or not your image aspect ratio.
Oversize
If true it will oversize the image when width > height or the otherwise.
ScaleUp
Set true if want allow the image to scale up from a small size to a bigger one.
PadColor
Hexadecimal color string for the image background if does not fit the canvas, default is 'transparent'.
FitPad
Set true if want to make use of the Position to fit the image in the canvas when the new size does not fit and AspectRatio is true.
Position
Set the position of source in the canvas:
- 'tr': top right
- 'tl': top left
- 'tc': top center
- 'br': bottom right
- 'bl': bottom left
- 'bc': bottom center
- 'cr': center right
- 'cl': center left
- 'cc': center horizontal and vertically