rifanece / timthumb

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

20kb JPG file converts to a 200kb PNG file - increase in file size #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. The original uploaded JPG -->
http://greensidegolf.wwc.co.za/wp-content/uploads/2009/04/thailand_cimarrone-gcc
1.jpg
2. The re-sized PNG file -->
http://greensidegolf.wwc.co.za/wp-content/themes/greensidegolf/thumbs.php?src=/w
p-content/uploads/2009/04/cimarrone-gcc.jpg&w=469&h=280&zc=1&q=75
3.

What is the expected output? What do you see instead?
The file-size of the re-sized JPG should not be 10 times bigger. 20kb -->
200kb. It also changed the file to a PNG which is ok, but not sure if that
is the default behavior 

What version of the product are you using? On what operating system?
1.07 running on a linux server

Please provide any additional information below.

If there is any other information you need, please let me know!

Thanks Jason

Original issue reported on code.google.com by jasonbagley on 14 Apr 2009 at 11:22

GoogleCodeExporter commented 8 years ago
Hi...

I am having the same problem. The original JPG is resized to a PNG... but the
file-sizes are the same. 

One extra thing that is happening is that I can't see the image in IE 6.0...

Thx a lot for the support and for the nice timthumb!!!

Shark!

Original comment by cristhia...@gmail.com on 20 Apr 2009 at 8:11

GoogleCodeExporter commented 8 years ago
I switched all the files to pngs rather than jpgs but this sounds like it's not 
as
good an approach as I had imagined. This was mostly for scaling transparent 
images
but also for ease of development. I shall look at changing the conversion so it
ignores jpg images so that we can get the size down again as this is clearly a 
bit nuts.

Thanks for pointing it out

Original comment by BinaryMoon on 21 Apr 2009 at 5:38

GoogleCodeExporter commented 8 years ago
Thank you for your prompt reply.

I was not able to see the image in IE 6.0 while I was the following code:

<?php //Check if custom field key "Image" has a value
$values = get_post_custom_values("Image");
if (isset($values[0])) {
?>
<img src="<?php echo bloginfo('template_url'); 
?>/scripts/timthumb.php?src=/<?php
$values = get_post_custom_values("Image"); echo $values[0]; 
?>&w=300&h=275&q=100"
alt="<?php the_title(); ?>" />
<?php } ?>

But after I decided to use the following one and it is working:

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php
the_title(); ?>">
<img src="<?php echo bloginfo('template_url'); 
?>/scripts/timthumb.php?src=/<?php
$values = get_post_custom_values("Image"); echo $values[0]; 
?>&w=300&h=275&zc=1&q=100"
alt="<?php the_title(); ?>" class="left" width="300px" height="275px"  /></a>

Hope it can help!

Original comment by cristhia...@gmail.com on 21 Apr 2009 at 3:59

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hello again!

What is the issue?
I am having size problem with a JPG image

What steps will reproduce the problem?
1. The original uploaded JPG -->
http://laoja.in/wp-content/uploads/2009/04/sand_woman2.jpg
2. The re-sized JPG file -->
http://laoja.in/wp-content/themes/sandbox/scripts/timthumb.php?src=/wp-content/u
ploads/2009/04/sand_woman2.jpg&w=940&h=350&zc=1&q=100

What is the expected output? What do you see instead?
The file-size of the re-sized JPG should not be X times bigger.

What version of the product are you using? On what operating system?
Linux Server 

Right now I am using this version file_1, which increases the JPG size but not 
too much.

*Because when I use the latest one is when the PNG file is increazed 10 times*

Please provide any additional information below.

Thx!

Original comment by cristhia...@gmail.com on 23 Apr 2009 at 9:31

Attachments:

GoogleCodeExporter commented 8 years ago
Attached is a modified timthumb.php which creates JPGs instead of PNGs, which 
results
in a smaller filesize. Works for me, but don't blame me if it eats your 
computer ;-)

Original comment by christop...@gmail.com on 1 Jun 2009 at 3:14

Attachments:

GoogleCodeExporter commented 8 years ago
@christoph
Thanks for your modified timthumb. 
Before, my JPG/PNGs were getting *heavier* as I dialed down the quality. With 
your
version, the files are almost 90% lighter at the same quality setting. This is 
more
like it! 
@BinaryMoon
Apart from the JPG/PNG bug, great script! Thanks for it. Looking forward to the
official fix.

Original comment by elri...@gmail.com on 4 Jun 2009 at 8:21

GoogleCodeExporter commented 8 years ago
@Binarymoon - Is there any way of fixing this in the main script? If we use this
hacked version it makes .jpgs that are way smaller, but we can't use the quality
setting any more. 

Original comment by magnusje...@gmail.com on 16 Jun 2009 at 3:53

GoogleCodeExporter commented 8 years ago
@cristhiansg:
Your modified version was great. Thanks for sharing it with us!

However I have one more request. I would like to crop the image from the top 
edge
instead of the center of the image. I used to be able to change this line in 
original
timthumb.php from "imagecopyresampled( $canvas, $image, 0, 0, $src_x, $src_y,
$new_width, $new_height, $src_w, $src_h );" to "imagecopyresampled( $canvas, 
$image,
0, 0, $src_x, 0, $new_width, $new_height, $src_w, $src_h ); " and it did work. 
But
with your version it seems that there is no effects at all no matter what I do 
to the
imagecopyresampled function.
If you or someone else can help me out, that would be much appreciated.

Original comment by louis.a1...@gmail.com on 20 Jun 2009 at 6:45

GoogleCodeExporter commented 8 years ago
Indeed, the 'hacked' version makes a huge difference in file size, although 
also in 
quality, which can't be altered anymore with the q parameter.

It would be great if the quality settings could still be used, to get slightly 
better images (and slightly bigger).

Update would be greatly appreciated.

Original comment by icexu...@gmail.com on 20 Aug 2009 at 4:51

GoogleCodeExporter commented 8 years ago
The 'hacked' version works great. Thanks.
But yes, quality setting would be nice.

Is timthumb still actively developed?

Original comment by tilman.k...@gmail.com on 20 Aug 2009 at 10:39

GoogleCodeExporter commented 8 years ago
please help to get this fixed. my 5 kb gif gets converted to 60kb png.

Original comment by Dhru...@gmail.com on 24 Aug 2009 at 7:28

GoogleCodeExporter commented 8 years ago
Attached is a modified version of christoph.boecken's file. Now the quality 
setting
works.

Original comment by gmore...@gmail.com on 7 Sep 2009 at 6:50

Attachments:

GoogleCodeExporter commented 8 years ago
@Christoph. Thanks for your version. I felt sudden swiftness in my site.

@gmorenog. Thanks, now testing your mod of Chritstoph, but feels sluggish at 
the moment

Original comment by masroor....@gmail.com on 23 Sep 2009 at 6:11

GoogleCodeExporter commented 8 years ago
Hi
I have a smilar problem that the timthumb code above doesn't seem to make any
difference :(
my files are not changing into pngs or very large jpegs, however as soon as I 
ad just
two images (either cropped to exact size or large) my page takes about 4-6 
seconds to
load anything, thne the whole page appears all at once. If I take the images 
out it
appears instantly like all the other pages.

Can anyone help? many thanks in advance.

demo site here http://www.mepphotography.co.uk the problem is on the homepage.

Original comment by p...@hairbrainedschemes.co.uk on 9 Nov 2009 at 11:27

GoogleCodeExporter commented 8 years ago
This should be fixed now, make sure to use the latest version of the code

Original comment by BinaryMoon on 31 Dec 2009 at 7:28

GoogleCodeExporter commented 8 years ago
@BinaryMoon,

Thanks for the updated file, it has cured my issue of excessively large images 
in my 
theme.
I have a thought, would it be possible to get timthumb to only create images 
based 
on original mime type eg png = png, jpg = jpg & gif = gif..? This I feel would 
be 
far better for the majority of users as it gives them the option to create 
their own 
image in whatever format, prior to uploading to their theme. 
So as an example, if I wanted to use a true color image with transparency, then 
I 
would create a png image & after upload to my theme, timthumb should then 
create a 
png thumbnail, if I chose to use a plain jpg then timthumb should create a jpg 
& the 
same for gif.

Original comment by c3lt1...@gmail.com on 26 May 2010 at 5:09

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The latest version does the trick for me, thanks for the help guys. If anyone 
is interested on how to use the TimThumb.php, I just finished writing a 
tutorial. You can check it out here:

http://www.heinencreative.com/archives/tutorials/cropping-images-using-timthumb/

Original comment by heinencr...@gmail.com on 26 Jun 2010 at 1:58

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
@christoph
Thanks a lot Man...:)

I use gif images for my Website's Thumbnails to get minimum size as possible.
Since timthumb.php coverted them to png's and that resulted in heavier Images 
so there was no point of making low size gif images.

Using you modified timthumb.php script reduced the size of my Website Home Page 
from
493kb to 88.4 kb

My Website: www.cgterminal.com

Original comment by dk3dmave...@gmail.com on 8 Jun 2011 at 7:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
@christoph
Thanks a lot Man..)
You are a life saver.

Avi Nanrey
http://www.celestexptech.com

Original comment by av...@celesteexperience.com on 28 Jun 2012 at 4:48

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
ow my god ow my goddddd @christoph thank you thank you guys you are the best :) 
ow my god

Original comment by farzam....@gmail.com on 26 Mar 2014 at 8:46