Created: May 11, 2017
by: SourceAssassins (sourceassassins@gmail.com)
Thank you for purchasing the UTCPRO.
ULTRA THUMBNAIL CREATORPRO is a php class for on-the-fly image resizing.
It's ideal for any website hosted on php enabled server.
Thumb width and height are calculated not to exceed width and height given in the image url.
Usage example
Enlarged images, single images.
Thumb width is constant (defined by width given in the image url). Thumb height is calculated based on width given in the image url and source image aspect ratio.
Usage example
Vertical galleries (vertical thumbs lists).
Thumb height is constant (defined by height given in the image url). Thumb width is calculated based on height given in the image url and source image aspect ratio.
Usage example
Horizontal galleries (horizontal thumbs lists).
This mode creates image of exact width and height given in the image url. Part of original image is cropped and resized to desired resolution.
Usage example
Galleries (thumbs lists):
Product list thumbs:
This mode creates image of exact width and height given in the image url. Original image is resized to fit into the boundaries. If source image is PNG additional image areas will be transparent otherwise it will be white.
Usage example
Logotype lists or logotype tickers/sliders.
Product list thumbs (when you don't want images to be cropped).
A PHP enabled server (version 5.0+) with Image Magick (version 6.0+) enabled is required for the script to work.
To install the UTCPRO on your website just follow these easy steps:
Step 1
Copy the class/utcpro.class.php and class/utcpro.settings.php to your site class folder.
Step 2
Copy the img.php to your site folder anywhere you want (best practice is to put it into root directory of your project)
Step 3
Set path to the utcpro.class.php and utcpro.settings.php in your img.php file at line 6:
include_once('your/path/to/utcpro.class.php'); include_once('your/path/to/utcpro.settings.php');
include_once('class/utcpro.class.php');
include_once('class/utcpro.settings.php');
include_once('/home/username/public_html/class/utcpro.class.php');
include_once('/home/username/public_html/class/utcpro.settings.php');
include_once('http:/yourdomain.com/class/utcpro.class.php');
include_once('http:/yourdomain.com/class/utcpro.settings.php');
Step 4
Now, all you have to do is set proper configuration in the your/path/to/utcpro.class.php.
Find out more about configuration in the next section of this document.
Step 5
Create links to images in your project like this:
img.php?img=image_name.jpg&mode=cl&w=300&h=200
img.php?img=image_1.png&mode=ci&w=360&h=240&bw=1
img.php?img=photo.jpg&mode=cm&w=220&h=220&bw=1&wm=1
Of course you can use url masking with any type of routing (ie. through .htaccess file or framework routing).
Find out more about creating links in the usage section.
Step 6
Protect your original images:
In order to show 'Original image' in the interactive demo browser access to images directory has to be unlocked.
Remove the comment tag (# at the beginning of the first line) from the images/.htaccess to block browser access to original images.
Step 7
More security options:
You can change default GET variable names such as 'img', 'mode', 'w', 'h', 'bw', 'wm', 'wmp', 's' in img.php file to prevent protection breach.
UTCPRO set-up doesn't require any php knowledge (all right, maybe just basics of basics).
There are few class variables you may want to set before you start using UTCPRO
Here is a list of UTCPRO class variables settings (file: utcpro.class.php):
Basic settings | |||
---|---|---|---|
variable | values | default value | description |
$filesPath | some/path/ (string) |
images/ | Defines the location of your images. You can define it like this: my/images/ ../../../my/images/ /home/user/images Remember to set proper CHMOD / CHOWN for images folder. You can NOT define it like this: http://www.yourdomain.com/my/images/ |
$cachePath | some/cache/ (string) |
cache/ | Defines the location of generated, cached images. You can define it like this: my/cache/ ../../../my/cache/ /home/user/cache Remember to set proper CHMOD / CHOWN for cache folder. You can NOT define it like this: http://www.yourdomain.com/my/cache/ |
$cacheEnabled | 0/1 | 1 | Enables caching of created thumbnails. Even though the cache is disabled you still have to define $cachePath. |
$quality | 1 - 100 | 100 | Quality of saved JPEG images. Increasing quality will have effect on created file size (higher quality = bigger file). $quality applies only to JPEG format. |
Advanced settings | |||
$forceWatermark | 0/1 | 0 | Forces watermark protection on generated images. When set to 0 watermark will only be applied when you set wm=1 in the image url. However it's not recommended to pass watermark through open url as wm=1 due to easy protection breach. |
$forceBlackAndWhite | 0/1 | 0 | Forces black&white image filter. When set to 0 filter will only be applied when you set bw=1 in the image url. |
$watermarkPatternFile | my/watermark-pattern.png (string) |
images/watermark/logo-pattern.png | Path to your pattern watermark image. This image has to be PNG@24bit format. If you want your watermark to be transparent you'll have to pre-set transparency in the watermark file. |
$watermarkPatternMinWidth | 0 - infinity integer |
0 | Minimum width of generated image to apply pattern watermark. Set it to 0 to pattern-protect every single image. |
$watermarkPatternMinHeight | 0 - infinity integer |
0 | Minimum height of generated image to apply pattern watermark. Set it to 0 to pattern-protect every single image. |
$watermarkFile | my/watermark.png (string) |
images/watermark/logo.png | Path to your watermark image. This image has to be PNG@24bit format. If you want your watermark to be transparent you'll have to pre-set transparency in the watermark file. |
$watermarkOffset | 0 - infinity | 5 | Defines offset of the watermark. Set it to 0 to put watermark at the edge of generated image. $watermarkOffset doesn't apply to 'cc' and 'pattern' watermark positions. |
$watermarkRelativeSize | 0 - 1 float |
0.3 | Defines maximum size of watermark relatively to generated image dimensions. Bigger image = bigger watermark. $watermarkRelativeSize doesn't apply to 'pattern' watermark position. |
$watermarkMinWidth | 0 - infinity integer |
0 | Minimum width of generated image to apply classic watermark. Set it to 0 to watermark-protect every single image. |
$watermarkMinHeight | 0 - infinity integer |
0 | Minimum height of generated image to apply classic watermark. Set it to 0 to watermark-protect every single image. |
$watermarkPosition | tl/tr/bl/br/cc/tc/bc/cl/cr/pattern | bl | Defines the position of the watermark. Available positions: and 'pattern' mode: It's not recommended to pass watermark position through open url as wmp=tl due to easy protection breach. |
$watermarkBlackAndWhite | 0/1 | 0 | Applies black&white filter to the watermark. |
$noImage | my/no-image.png (string) |
images/default/no-image.png | Path to your custom 'no-image' image. This image is used to generate thumbnail when given image file doesn't exist at defined location. You can define it like this: my/images/noimage.png ../../../my/images/noimage.png /home/user/images/noimage.png You can NOT define it like this: http://www.yourdomain.com/my/images/noimage.png |
$defaultMode | ci/cbw/cbh/cm/cl (string) |
ci | Default work mode. Used when you don't pass mode in the image url. |
$allowSubFolders | 0/1 | 1 | Allows to process images placed in subfolders of $filesPath |
$checkOrientation | 0/1 | 1 | Automatically rotates images with non-standard orientation (reads from EXIF-data) |
$defaultFillColor | color hex (string) | #ffffff | fill color for 'logo mode' images |
You can prepare sets of settings at class/utcpro.settings.php
$settings = array( 'gallery_small' => array( 'mode' => 'cm', 'w' => 200, 'h' => 200, 'bw' => 0, 'wm' => 0, ), 'product_large' => array( 'mode' => 'ci', 'w' => 1200, 'h' => 800, 'bw' => 0, 'wm' => 1, 'wmp' => 'cc', ), ... );
All variables defined in each set are listed and explained in the usage section.
To use UTCPRO you have to create links to images in your project like this:
img.php?img=my/folder/image_name.jpg&w=300&h=200&mode=cl&wm=1&wmp=cc&bw=1
If you are using prefefined settings the links should look like this:
img.php?img=gallery/image_name.jpg&s=gallery_small
If you don't allow subfolders in the $filesPath directory ($allowSubFolders=0) your link should look like this:
img.php?img=image_name.jpg&w=300&h=200&mode=cl&wm=1&wmp=cc&bw=1
or this:
img.php?img=image_name.jpg&s=gallery_small
Using open links | ||||
---|---|---|---|---|
variable | type | required | description | |
img | string | Image path (relative to defined $filesPath). For example: my/image/folder/picture01.jpgPaths starting with "/", http://, https:// or ftp:// will cause 404 error. If you set $allowSubFolders to 0 the img parameter must contain only file name, without path/folders. For example: picture01.jpg |
||
w | integer w > 0 |
Desired width of generated thumbnail. | ||
h | integer h > 0 |
Desired height of generated thumbnail. | ||
mode | string predefined |
Work mode. Must be one of predefined workmodes. If not set $defaultMode will be used. | ||
wm | integer 0/1 |
Watermark flag. Set to 1 to apply watermark. It's not recommended to pass this through open url as wm=1 due to easy protection breach. |
||
wmp | string predefined |
Watermark position. Must be one of predefined watermark positions. If not set , the default watermark position will be user (defined in utcpro.class.php as $watermarkPosition). It's not recommended to pass this through open url as wmp=1 due to easy protection breach. |
||
bw | integer 0/1 |
Black&white filter. Set to 1 to apply black&white filter on generated image. Please note that watermark will still be in its original colors. To set watermark to B&W set $watermarkBlackAndWhite to 1. |
Using predefined settings | ||||
---|---|---|---|---|
variable | type | required | description | |
img | string | Image path (relative to defined $filesPath). For example: my/image/folder/picture01.jpgPaths starting with "/", http://, https:// or ftp:// will cause 404 error. If you set $allowSubFolders to 0 the img parameter must contain only file name, without path/folders. For example: picture01.jpg |
||
s | string predefined |
Predefined settings key. Set of settings should be defined in the class/utcpro.settings.php. It's not recommended to pass this through open url as s=product_thumb due to easy protection breach. |
Here's a list of 3rd party resources used to develop UTCPRO
Version 1.1 - September 7, 2017
Version 1.0 - May 11, 2017
If you are going to rate this product less than 5 stars, please let me know what I can do to make it worth 5 stars for you. Leave a comment or send me an email (sourceassassins@gmail.com). Who knows, maybe your suggestion will make it in to a future version of UTCPRO!
Once again, thank you for purchasing UTCPRO. If you have any questions related to usage or installation I'll be glad to help you. Any development suggestions are also welcome. Just contact me via sourceassassins@gmail.com or support form.
--
best regards
SourceAssassins