Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43259
Total Topics: 7518
Most Online Today: 201
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 181
Total: 181

Author Topic: Resized images are Larger than original filesize  (Read 4535 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);
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

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

David

Offline SMFHacks

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

Dave

 

Related Topics

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

+- Recent Topics

No thumbnails on new uploads by SMFHacks
March 27, 2024, 02:10:41 pm

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Gallery icon as last added image by fvlog19
February 01, 2024, 01:04:56 pm

Powered by EzPortal