XF 2.1 Uploaded images increase massively in file size.

RallyFan

Well-known member
Hi all,

I have an interesting one here. I'm using default image processor (GD).

I'm testing uploading file sizes for photos, and noticed that the stored image file sizes are HUGE compared to uploaded originals.

For the purpose of testing I have set the server to accept up to 30MB files in size (previously 5MB), and disabled maximum image dimensions.

TEST IMAGE 1
Format
: .JPG
Resolution: 2688 x 1520
Taken from: Mobile Phone
File size on PC: 450KB
Forum file size (when saved from forum to PC): 1.35MB
Forum file format (when saved from forum): .PNG

TEST IMAGE 2
Format
: .JPG
Resolution: 5184 x 3456
Taken from: Canon DSLR
File size on PC: 2.4MB
Forum file size (when saved from forum to PC): 12.79MB
Forum file format (when saved from forum): .PNG

I'm on a Shared Hosting platform (not a VPS).

Is this a problem or configuration issue with GD (or inside Xenforo), or by design? Would flicking over to ImageMagick resolve this issue?
 
i am curious about the concept....i noticed an effect like this with any forum/gallery type software ive used for the last decade but never fully understood why or how to avoid...

i didnt see as drastic of a difference in my brief testing....i believe in some cases i traced it back to the software resize operation....would be nice to have an out of the box solution to optimize this tho....esp considering we have no option for large image embeds and are forced to use the full original file!
 
@Brogan or @Chris D I'm wondering if you might have some insight on this one, if I can have a moment of your time :)

i am curious about the concept....i noticed an effect like this with any forum/gallery type software ive used for the last decade but never fully understood why or how to avoid...

i didnt see as drastic of a difference in my brief testing....i believe in some cases i traced it back to the software resize operation....would be nice to have an out of the box solution to optimize this tho....esp considering we have no option for large image embeds and are forced to use the full original file!
In doing some reading I believe the issue is that the images are stored largely uncompressed (which would result in them being the size of a BMP file of that resolution).

The question is why (given PNG and JPG can be heavily compressed without quality loss), and if this is a GD / server limitation, or forum software based.

Where I can see this being a real issue is in fan based forums where people might be encouraged to share photos. They head out and take photos from their phones and want to share it immediately with forum members.

With newer phones creating larger resolution (and sized) images, it could be a problem.

If a 5MB image grows to 15MB uncompressed, the drag viewing threads could be felt as well.
 
and here are the file sizes.

IMG_7987.xxx = the same original file in 3 formats. The JPG was loaded in Patin Shop Pro and psated straight into the forum from there.

As you can see, the file significantly increases in size from the original JPG file, once uploaded then downloaded from the forum.

The larger the file used, the bigger the blowout.

So the issue is not just with my forum/server/config.

1589933920612.webp
 
Okay after some extensive testing I've concluded that the issue DOES occur on here (and that my terminology might be leading to some confusion).

What I'm referring to when I say "uploading", is when you copy and paste an image into a thread (like many members do), and it automatically uploads it to your server (not when using "Attach Files".

I have tested and confirmed that the issue occurs in this thread: https://xenforo.com/community/threads/testing-image-pasting-this-is-a-900kb-jpg-on-disk.180628/

and again tested in your thread @Brogan here: https://xenforo.com/community/threads/test.180619/

This is how the files show on my PC:
1589935927395.webp

FFU = Firefox Uploaded
GCU = Google Chrome Uploaded
MSE = Microsoft Edge Uploaded

DLD = Dowloaded.

AndyB mentioned to me in PM that the issue might be because files get recreated when pasted as a new PNG file.

Is there a way to change that?
 

The image in the clipboard is typically always BMP format (DIB in fact; Device Independent Bitmap). If you're lucky, it'll be on there as PNG, when it comes from Gimp or MS Office or something, meaning you can retain reliable alpha on it. But when you copy an image to the clipboard, the clipboard never stores the original file.
 
Happens regardless of browser or using MS Paint / Paint Shop Pro, or Photoshop.

its still the operating system. When you hit copy, you aren’t copying a jpg. You are copying the raw uncompressed image. When you paste, seems like the browser has to decide what to do with raw image data... and it seems like it’s saving it to a png

its like if you copied a paragraph from a word document and pasted it into chrome... it wouldn’t paste as a word file. It would paste as text.
 
Last edited:
its still the operating system. When you hit copy, you aren’t copying a jpg. You are coping the raw uncompressed image. When you paste, seems like the browser is pasting it as a png

its like if you copied a paragraph from a word document and pasted it into chrome... it wouldn’t paste as a word file. It would paste as text.
Windows 7 / Windows 8 / Windows 10 / Android ... all have the same issue cross browser.

I get what you are saying but it's an issue with either image processor, or Froala processing a raw pasted image as PNG rather than JPG for some reason. If you block PNG as a file attachment, it reverts to JPG files being uploaded from a pasted image.

Since posting this thread I've found others noticed the same issue:

and

 
  • Like
Reactions: arn
Windows 7 / Windows 8 / Windows 10 / Android ... all have the same issue cross browser.

I get what you are saying but it's an issue with either image processor, or Froala processing a raw pasted image as PNG rather than JPG for some reason. If you block PNG as a file attachment, it reverts to JPG files being uploaded from a pasted image.

Since posting this thread I've found others noticed the same issue:

and


Granted, it maybe Froala doing the PNG conversion from image data.

It also happens here: https://pasteboard.co
 
Top Bottom