Download the PHP package tacnoman/thumcno without Composer
On this page you can find all versions of the php package tacnoman/thumcno. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package thumcno
Thumcno - A Tacno Thumbnail Generator in runtime
Pre requisites
To use thumcno, you need install the php-gd first.
You must install composer too. [https://getcomposer.org/]
Installation
Based on timthumb: http://www.binarymoon.co.uk/projects/timthumb/
You can use for any projects with different domains.
How it works?
There are many solutions to crop images. I like the timthumb solution. The request goes to a php file with params. The crop happen in runtime and generate a cache file. The Thumcno project, add a security for this and reuse for multiple projects. It's veeeery easy to use! I'll show you!
First step:
You need to add your custom domain. You could run:
This command will generate a file called img.mydomain.com.ini
in /app/apps
directory.
This file contains the custom configuration for this domain (example: cache directory, etc).
This params will replace the params in default.ini (you can change it).
This is the default.ini
.
You need to replace only the necessary.
See working in local machine
To see in your local machine, run this commands:
Running with Docker
Using with docker-compose
TODO THIS!
Now, go to your browser and open the url:
http://localhost:8888/?src=/dubai.jpg&w=200&h=200&q=80
You will see this:
Possible params
This list is the params that you can pass in url ($_GET):
parameter | stands for | values | What it does |
---|---|---|---|
src | source | url to image | Tells Thumbcno which image to resize |
w | width | the width to resize to | Remove the width to scale proportionally (will then need the height) |
h | height | the height to resize to | Remove the height to scale proportionally (will then need the width) |
q | quality | 0-100 | Compression quality. The higher the number the nicer the image will look. I wouldn’t recommend going any higher than about 95 else the image will get too large |
a | alignment | c,t,l,r,b,tl,tr,bl,br | Crop alignment. c = center, t = top, b = bottom, r = right, l = left. The positions can be joined to create diagonal positions |
zc | zoom/crop | 0,1,2,3 | Change the cropping and scaling settings |
f | filters | too many to mention | You can use the link above |
s | sharpen | Apply a sharpen filter to the image, makes scaled down images look a little crisper | |
cc | canvas colour | hexadecimal color(#fff) | Change background colour. Most used when changing the zoom and crop settings, which in turn can add borders to the image. |
ct | canvas transp | true (1) | Use transparency and ignore background colour |
style | thumb sizes | string | String to define the style of the size, for example, thumb=30x30, medium=200x200 and big=800x800 |
Set possible sizes
If you don't set the sizes, you could have a big security problem!
Suppose that your URI is this <w>/<h>/<src>
. A hacker could make a script to generate ALL POSSIBLE SIZES in cache.
But, you can define the possible sizes to generate in your website. It's simple:
Now, you can generate thumbs only with sizes 30x30, 200x200 and 800x800.
If you don't want to show the size in the URL, you can use the style
(like paperclip for ruby).
The style will replace the size. An example for this config is:
http://<domain>/?src=dubai.jpg&style=medium
-> Without friendly url.
http://<domain>/medium/dubai.jpg
-> Considering a friendly url, where the uri is /(?P<style>\w+)/(?P<src>(\w|-|\.)+)
.
URL Friendly
If you want to use friendly urls, you can set the params in your .ini file passing the URLS params. (You must know abour regex)
The param is route
and you can use the same url params in this format:
Bugs
Send-me an email: <[email protected]>.
All versions of thumcno with dependencies
vlucas/phpdotenv Version ^2.4
symfony/console Version *
katzgrau/klogger Version dev-master
codeception/codeception Version ^2.2