Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12356
Latest: Hermankidd
New This Month: 7
New This Week: 3
New Today: 1
Stats
Total Posts: 39780
Total Topics: 7006
Most Online Today: 56
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 37
Total: 37

Author Topic: Resized images are Larger than original filesize  (Read 3227 times)

0 Members and 1 Guest are viewing this topic.

Offline dlomneck

  • Newbie
  • *
  • Posts: 11
    • View Profile
Resized images are Larger than original filesize
« on: November 24, 2007, 12:50:36 am »
When I upload an image, say 1.25mb at 2576x1932pixels, And I have the gallery set to resize the image to a max of 1024x768pixels, I would expect the filesize to go DOWN.  Instead, the filesize increases to 1.34mb.  This is totally baffling me, as the reason for resizing an image would be to atleast lower the filesize a bit.

I have searched the forum, and the two methods I have found online don't seem to help me at all.
I found this in Gallery.php:
Code: [Select]
if ($sizes[2] == 2)
  imagejpeg($image, $filename);
 if ($sizes[2] == 3)
  imagepng($image, $filename);
And replaced it with this(trying numbers from 0-100 with absolutley no change in filesize, exactly the same size down to the bit):
Code: [Select]
if ($sizes[2] == 2)
  imagejpeg($image, $filename, 0);
 if ($sizes[2] == 3)
  imagepng($image, $filename);

I also found in Subs-Graphics.php
Code: [Select]
if (!empty($modSettings['avatar_download_png']))
imagepng($dst_img, $destName);
else
imagejpeg($dst_img, $destName);
and replaced it with this(same as above):
Code: [Select]
if (!empty($modSettings['avatar_download_png']))
imagepng($dst_img, $destName);
else
imagejpeg($dst_img, $destName, 0);

Yes, I realize that the resize function is set to resize by dimensions and not filesize, but it seems a bit ridiculous that at nearly 1/3 of the size in dimensions, the filesize gets BIGGER.  Can somebody please help?  I have GD installed, this is from my phpinfo:

Quote
GD Support    enabled
GD Version    bundled (2.0.28 compatible)
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.1.9
T1Lib Support    enabled
GIF Read Support    enabled
GIF Create Support    enabled
JPG Support    enabled
PNG Support    enabled
WBMP Support    enabled
XBM Support    enabled

Can somebody PLEASE help.  The main reason for this purchase was the resize ability, and at this rate, I'll quickly run out of space on my webhost.  I'm using SMF Gallery Pro 1.3.4 which I just downloaded an installed 5hrs ago.  SMF 1.1.4 and  TinyPortal v0.9.8. Thank you very much.

Dave

Offline dlomneck

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Resized images are Larger than original filesize
« Reply #1 on: November 24, 2007, 01:17:23 am »
ok, I figured it out, and I would say this is something that really needs to be addressed.

First, for clarification, the changes I made in sub-graphics.php affect the quality of the "Thumbnail" only.  If you want to decrease the quality/filesize of a resized image (like if you upload 2000x2000 and you want it resized to 1000x1000), then you need to also make the change in "gallery.php" 

Using the value 65 seemed like a nice quality/filesize, but tweak yourself.

My problem was that the images, even though they were .jpg files being uploaded, were being converted to .png files.  It wasn't apparent at first, because when right clicked and saved as, it still put .jpg filename on the end.  Opening the .jpg in text editor and you can see the first part clearly says "PNG". 

What was causing this?  A setting in SMF called "Use PNG for resized avatars?" in the Attachments and Avatars/Avatar Settings  section in Admin.  Unchecking that allowed the two modification I made to ACTUALLY work.

I would think that the Gallery Pro should work independent of other settings in SFM.  For me, the Use PNG setting was selected by default, and thus had me "broken" from the very start.  I hope this post helps others.  Sorry to double post.

David

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14904
    • View Profile
Re: Resized images are Larger than original filesize
« Reply #2 on: November 24, 2007, 09:27:41 pm »
Thanks for the information.

Added this to the next update. Checks if the file is not a PNG file if not then it disables the avatar_download_png settings and saves the file as jpg instead of png.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline dlomneck

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Resized images are Larger than original filesize
« Reply #3 on: November 25, 2007, 01:37:19 pm »
Excellent!  Thanks

Dave

 

Related Topics

  Subject / Started by Replies Last post
7 Replies
4612 Views
Last post January 24, 2007, 08:58:17 pm
by mlinvin
1 Replies
2857 Views
Last post June 10, 2009, 10:35:42 pm
by blackking18
11 Replies
5628 Views
Last post April 12, 2011, 03:11:54 pm
by rjez16
5 Replies
2079 Views
Last post August 02, 2011, 12:34:29 pm
by SMFHacks
10 Replies
3305 Views
Last post July 26, 2015, 01:27:16 pm
by Michel68

+- Recent Topics

[Mod]Login Menu Button by SMFHacks
July 05, 2019, 03:26:24 pm

Update by SMFHacks
June 19, 2019, 10:58:25 am

About Comments Approval by ajac63
June 12, 2019, 07:48:52 pm

Pretty Urls extras by SMFHacks
June 06, 2019, 12:14:53 pm

About using chmod to secure files by ajac63
June 05, 2019, 04:02:28 am

Bulk upload image problem by SMFHacks
June 01, 2019, 07:24:00 pm

About Watermark Options by ajac63
May 30, 2019, 05:25:39 pm

Why PayPal only by ajac63
May 30, 2019, 04:20:47 pm

Seller ToU not showing by ajac63
May 29, 2019, 01:59:24 am

Not happy by ajac63
May 28, 2019, 06:37:58 pm

Powered by EzPortal