It was recently pointed out to me that there's no single place to get a list of all the TimThumb parameters so I thought I would put together a page explaining them, and link to the relevant tutorials/ explanations.
TimThumb Parameters
| stands for | values | What it does | |
|---|---|---|---|
| src | source | url to image | Tells TimThumb which image to resize › TimThumb basic properties tutorial |
| w | width | the width to resize to | Remove the width to scale proportionally (will then need the height) › TimThumb width tutorial |
| h | height | the height to resize to | Remove the height to scale proportionally (will then need the width) › TimThumb height tutorial |
| 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 › TimThumb image quality tutorial |
| 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 › TimThumb crop position tutorial |
| zc | zoom / crop | 0, 1, 2, 3 | Change the cropping and scaling settings › TimThumb crop scaling tutorial |
| f | filters | too many to mention | Let's you apply image filters to change the resized picture. For instance you can change brightness/ contrast or even blur the image › TimThumb image filter tutorial |
| s | sharpen | Apply a sharpen filter to the image, makes scaled down images look a little crisper › tutorial | |
| cc | canvas colour | hexadecimal colour value (#ffffff) | Change background colour. Most used when changing the zoom and crop settings, which in turn can add borders to the image. |
| ct | canvas transparency | true (1) | Use transparency and ignore background colour |
Hi Ben,
I've tried using "ct" for transparent canvas background.
However, neither "ct=1" nor "ct=true" worked for me.
Could you please help double-check this?
Thank you,
Eric
March 8, 2012 • @fuzzybee7
Have you took into account that transparency cannot be set for JPEG images, transparency is possible only in GIF and PNG images.
September 24, 2012
Yes - that's accounted for. I am well aware of the limitations of different image file formats
September 25, 2012
Hello.
How can I set "src" if image is out public html folder?
Thx.
March 27, 2012
I think it is missing a maximum and minimum pixel rate
August 13, 2012
I'm not sure what you mean?
August 15, 2012
Why not in Parameters max min ?
if jpg pixels 300x300px = timthumb = 100x200
if jpg pixels 300x100px = timthumb = 100x100
but make w&h paramer -> jpg pixel 300x100 = timthumb = 100x200 (zoom)
August 15, 2012
Are you able to set the width as a percentage?
August 17, 2012
I am afraid not - pixel values only.
August 18, 2012
Any plans to allow percentages instead of Pixels?
I've migrated to the LessIsMore framework which adjusts page width for the device/resolution viewed on...
Timthumb is kinda redundant unless it can do something similar with percentages...
Modern designers no longer design for a fixed width on screen then different pages for different media...and most webpages aren't viewed on a screen at all nowadays...
April 9, 2013
Hi - using percentage widths won't help with what you want to do. I'm a web designer - so I am well aware of responsive designs (try resizing your browser) however making TimThumb accept percentages won't change anything. You should read up on responsive images - I would recommend the max-width css property. No images in responsive design change actual dimensions - they are scaled in the browser.
April 11, 2013
Great script! Love it!
But could you please add a parameter to stop upscaling small images and keep the original size of an image if it's smaller than the size given at w or h?!
October 7, 2012
Does not work with transparent gif
. Transparent background is filled with color ..
October 10, 2012
Is there a way to remove the black spaces on top and at the bottom of the image like youtube thumbnail for example ?
In general, can I cut parts of the image with TimThumb ?
December 5, 2012
Ben, is there any proper way to pass parameters to timthumb when using fancy_image short codes?
January 3, 2013
I see that TT crops images when supplied with both a width and height. Is there a way to make it proportionally fit the image to a container?
IOW: if I have an image 500 x 500 and I have a space 250 x 500, the image should be resized to 250 x 250. Is this possible?
January 16, 2013
In this case if you supply just the width then the height will resize proportionally.
January 16, 2013
I described the nature of the problem poorly, but it looks like the zc=3 will do what I'm after. Thanks!
January 16, 2013
ah - I misunderstood. Great that you worked it out!
January 16, 2013
TimThumb not work watermark?
January 18, 2013
Ben all compliments for this script.
February 12, 2013
Does timthumb show image alt tags?
The script is used on a number of websites I own and it does not appear to show image alts.
March 29, 2013
TimThumb resizes images - it has nothing to do with the html used on the website. You will need to edit your template to make the alt tags display.
March 31, 2013
Hi.
When I work with external files (in the same server, but a different URL), the load of that images go very slowly.
How can I fix?
Thanks
April 1, 2013
You should only use images on the same domain. It doesn't matter what the server is - if the images are on a different domain then they will be copied over to the domain that hosts timthumb - and this is slow.
April 1, 2013