Facebook  Twitter 




+- User Information

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

+- Forum Stats

Total Members: 4200
Latest: [chrisB]
New This Month: 4
New This Week: 1
New Today: 1
Total Posts: 42599
Total Topics: 7433
Most Online Today: 103
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 54
Total: 54

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

0 Members and 1 Guest are viewing this topic.

Offline dlomneck

  • Member
  • *
  • 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);
imagejpeg($dst_img, $destName);
and replaced it with this(same as above):
Code: [Select]
if (!empty($modSettings['avatar_download_png']))
imagepng($dst_img, $destName);
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:

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.


Offline dlomneck

  • Member
  • *
  • 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.


Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16155
    • 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

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



Related Topics

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

+- Recent Topics

Errors with SMF2WPBridge by [chrisB]
Today at 10:16:59 am

Undefined index: id by SMFHacks
Today at 09:41:30 am

Permissions query by davejo
Today at 01:31:46 am

"Notify all store admins of item purchase" Not Working in SMF 2.1.2 or 2.1.3 by Michael Vail
Today at 01:02:34 am

Additional Recommendations for SMF Store by Michael Vail
November 26, 2022, 12:49:58 pm

SMF Store 5.0 Beta Errors - Trying to access array offset on value of type null by Michael Vail
November 26, 2022, 12:07:42 pm

Modification: Subcategories total in main gallery view by VisiGod
November 26, 2022, 11:27:34 am

Change log for Downloads Pro 6.13 and 6.14 by Nicole
November 20, 2022, 08:24:34 am

Release date? by SMFHacks
November 20, 2022, 08:09:10 am

Can't install due to missing file? by SMFHacks
November 18, 2022, 06:55:45 pm

Powered by EzPortal