irischen / timthumb

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

Display image at it's original size AND ability to use hex codes with COLORIZE filter #171

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
- If no 'w' or 'h' are provided, the image will be displayed at original size 
instead of default width and height.

- To use hex values with COLORIZE filter, for example:
timthumb.php?src=image.jpg&f=5&hex=ff0000

I hope it's ok with you, I've been playing around with the code and added the 
features by myself.

NOTE: The parts that I added are marked with /***ADDED***/
NOTE: I attached the modified PHP file

Original issue reported on code.google.com by tee.fo...@gmail.com on 9 Mar 2011 at 8:48

Attachments:

GoogleCodeExporter commented 9 years ago
Hex codes have now been implemented into TimThumb for the background colour. 
What's the use case for the image width and height? If you don't scale the 
image then don't use TimThumb :)

Original comment by BinaryMoon on 6 Aug 2011 at 8:00

GoogleCodeExporter commented 9 years ago
now that timthumb does all those filters, maybe you don't want to scale, but 
only use the timthumb filters?  makes some sense to me since i am struggling to 
do grayscale images any other way.  timthumb, otoh, is a breeze to set up. 

Original comment by helgathe...@gmail.com on 13 Aug 2011 at 9:58

GoogleCodeExporter commented 9 years ago
QUOTE: "If no 'w' or 'h' are provided, the image will be displayed at original 
size instead of default width and height."

That's wrong, as of version 2.8.10, it displays the image 100px by 100px
I had a look to the source and found that when TimThumb does not have new image 
width and height defined, it arbitrary defines them to 100px.

A quick fix to our problem is to edit lines 529 to 533 from 

        // set default width and height if neither are set already
        if ($new_width == 0 && $new_height == 0) {
            $new_width = 100;
            $new_height = 100;
        }

to

        // set default width and height if neither are set already
        if ($new_width == 0 && $new_height == 0) {
            $new_width = $sData[0];
            $new_height = $sData[1];
        }

The variable sData (defined on line 489) containing the original image size 
information.

Hope this helps.

Original comment by vinc...@polychrome.ch on 5 Jul 2012 at 7:17

GoogleCodeExporter commented 9 years ago
hi, i have the same problem here. i use timbthumb for larger images to be 
smaller not for smaller to be scaled up. plz allow an option to turn this scale 
up off on smaller images.

Original comment by alhose...@gmail.com on 27 Dec 2012 at 9:51

GoogleCodeExporter commented 9 years ago
Tnhks vinc...@polychrome.ch!!

Your code resolve to me!

Original comment by anpos...@gmail.com on 12 May 2014 at 5:00