khashnan / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

Opacity option #126

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I've merged TimThumb and the function filter_opacity found in a comment here 
http://php.net/manual/en/function.imagefilter.php

Then I've modified your code getting the o URL property
$opacity = get_request('o', 100);

And calling the filter_opacity at the end, before the sho_image
if ($opacity < 100){
    filter_opacity($canvas, $opacity);
}

The result is that passing o=XX as URL parameter I can display an opacified 
image. It useful for me and think It could be useful for others too.

Thanks for your code, Francesco.

strx.it

Original issue reported on code.google.com by fstr...@gmail.com on 19 Oct 2010 at 12:33

GoogleCodeExporter commented 8 years ago
Is there a reason you did this rather than use css opacity? I think it would 
make more sense to do this when you save the image or with css/ javascript.

The problem is that not all browsers (I'm looking at you IE) support 
transparency properly (at least not in older versions) so changing the image 
transparency wouldn't work everywhere anyway.

Original comment by BinaryMoon on 26 Oct 2010 at 1:11

GoogleCodeExporter commented 8 years ago
I've used it here: www.sulmonte.org

The body has a background image with an opacity of 20%, loaded from flickr. As 
you may imagine, here I cannot set the body CSS opaity to 20%, and it works 
also on IE thanks to a jQuery plugin.

The opacity sould be an option like others, the users have to decide to use it 
or not, I think.

Thank you, Francesco.

Original comment by fstr...@gmail.com on 26 Oct 2010 at 3:42

GoogleCodeExporter commented 8 years ago
I need this, but the code is not working. The code on the comments area of this 
site http://php.net/manual/en/function.imagefilter.php says it works only for 
png images. Were you able to make it work with jpg files?
And by the way, I don't see any image on the background of this site 
www.sulmonte.org

I'm using firefox 3

An advantage of using this, I believe, the resulting file will be smaller than 
using div opacity, resulting in less loading times.

THanks,
Marcus.

Original comment by marcusvd...@gmail.com on 18 Nov 2010 at 10:28

GoogleCodeExporter commented 8 years ago
Yes, it works for JPGs too...and sulmonte.org bg works with IE6 too...

Send me your email, I will send you my thumb version, bye

Original comment by fstr...@gmail.com on 20 Nov 2010 at 7:37

GoogleCodeExporter commented 8 years ago
Marcus - the file size will be larger than using pngs

Having it work for jpgs means that they will also be converted to pngs which 
will remove any compression savings you may have had before. Technically this 
is easy to add, but I don't think it's the best way to do this (css is much 
better) so I'm going to mark as won't fix.

Original comment by BinaryMoon on 21 Nov 2010 at 11:10

GoogleCodeExporter commented 8 years ago
Sorry but I don't understand why. 
It has not to be the default behaviour, but an add-on, like others...
However the last word is your, I will continue to use my patched version, no 
problem.

Thanks again, Francesco.

Original comment by fstr...@gmail.com on 22 Nov 2010 at 8:03