Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12384
Latest: MildredGarrido
New This Month: 8
New This Week: 0
New Today: 0
Stats
Total Posts: 39888
Total Topics: 7022
Most Online Today: 112
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 32
Total: 32

Author Topic: Resized images are Larger than original filesize  (Read 3258 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: 14953
    • 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
4659 Views
Last post January 24, 2007, 08:58:17 pm
by mlinvin
1 Replies
2902 Views
Last post June 10, 2009, 10:35:42 pm
by blackking18
11 Replies
5703 Views
Last post April 12, 2011, 03:11:54 pm
by rjez16
5 Replies
2114 Views
Last post August 02, 2011, 12:34:29 pm
by SMFHacks
10 Replies
3437 Views
Last post July 26, 2015, 01:27:16 pm
by Michel68

+- Recent Topics

prettyurls - TroubleShooting.wiki by Rock Lee
October 10, 2019, 11:37:09 am

Some issues with adding and editing a listing by ajac63
October 07, 2019, 04:16:40 am

Problem update 1.1.21 to 2.0.15 by Rock Lee
October 06, 2019, 06:09:16 pm

[Mod]SMF 2.0.x PHP 7.2 Support by sah62
October 04, 2019, 01:46:00 pm

Ideas by shuban
October 03, 2019, 10:19:06 pm

How to space icons and multiple reacts? by shadav
October 03, 2019, 04:20:07 pm

PrettyUrls SEO Pro by Rock Lee
October 01, 2019, 09:09:38 am

How to get search preciser by SMFHacks
September 23, 2019, 10:09:56 am

How to AVOID SEO Hit when Implementing PrettyURLs by SMFHacks
September 12, 2019, 08:50:42 pm

theme by SMFHacks
September 12, 2019, 07:10:51 am

Powered by EzPortal