Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

> PNG image attachment automatically gets JPEG-ed, This forum software is dumb

views
     
TSxenon
post Mar 22 2007, 07:47 PM, updated 13y ago

On my way
****
Senior Member
501 posts

Joined: Jan 2005
From: Selangor

I'm just expressing my discontent on this forum software. Whenever I want to attach a screenshot, I face this problem.
Take this example http://forum.lowyat.net/index.php?act=Atta...=post&id=207929
My original PNG file is 11.3kB, after attaching, the forum does some unnecessary work, recoding the image to JPEG sizing 55.9kB. The result is poorer image quality (mosquito artifacts) and multiple folds increase in file size.

I can get by this problem by using GIF format, but for more than 90% of the time, PNG achieves smaller size. In this example, the GIF is 27.6kB (still better than the forum software auto-JPEG). Another way is by using external image hosting. But I prefer to store those 20kB pictures on forum.lowyat.net as it is most likely loads fastest for the users.

So, my conclusion is this forum software is torturing itself, wasting computing resource, wasting disk space, wasting bandwidth. Solutions?
se7en
post Mar 22 2007, 07:57 PM

resistance is futile
Group Icon
Admin
1,792 posts

Joined: Jan 2003
From: Captain's Cabin, Black Pearl

what conversion? will test more later, but i reckon the forum might convert the thumbnail to jpg if its too big, but the image you upload should still be in png format.


Attached image(s)
Attached Image
TSxenon
post Mar 22 2007, 07:59 PM

On my way
****
Senior Member
501 posts

Joined: Jan 2005
From: Selangor

Oh, yeah. I think I experienced that before, smaller dimension (number of pixels) behave differently. Try bigger ones? 400x300 maybe?

Nope, the thumbnail JPEG is acceptable, but the problem is full size also JPEG.

This post has been edited by xenon: Mar 22 2007, 08:00 PM
se7en
post Mar 22 2007, 08:02 PM

resistance is futile
Group Icon
Admin
1,792 posts

Joined: Jan 2003
From: Captain's Cabin, Black Pearl

test 2


Attached thumbnail(s)
Attached Image
wKkaY
post Mar 24 2007, 06:35 AM

misutā supākoru
Group Icon
Admin
5,907 posts

Joined: Jan 2003
It's probably due to the code that adds that lowyat.net watermark to the image.

Do we want to add smarts to the routine? Hmm..
TSxenon
post Mar 24 2007, 07:54 AM

On my way
****
Senior Member
501 posts

Joined: Jan 2005
From: Selangor

I think the watermark adding doesn't happen to GIF attachment. By the way, I don't like watermark. Vote for remove watermark code.
se7en
post Mar 24 2007, 10:20 AM

resistance is futile
Group Icon
Admin
1,792 posts

Joined: Jan 2003
From: Captain's Cabin, Black Pearl

don't think its the watermark. It worked quite fine for the png that wasn't resized. I reckon it has something to do with the GD library that resizes PNG images.

wKkaY
post Mar 24 2007, 10:23 PM

misutā supākoru
Group Icon
Admin
5,907 posts

Joined: Jan 2003
Nuh uh.. smile.gif I checked the file type of that unresized thumbnail..

QUOTE
$ file post-2-1174564631.png
post-2-1174564631.png: JPEG image data, JFIF standard 1.01, comment: "CREATOR: gd-jpeg v1.0 (using IJ"

TSxenon
post Aug 11 2007, 08:12 AM

On my way
****
Senior Member
501 posts

Joined: Jan 2005
From: Selangor

Problem not solved yet.
Another problem is zip file gets gzip-ed automatically.
I would like the attachments to be treated as raw bytes, verbatim. The forum software shouldn't go busybody interpreting the bytes that I send.
It should also treat the whole file name as one string, don't interpret the extension. I found that the zip file problem occurs when the file name ends with .zip, it will not occur when it is named otherwise. There are quite a lot of file extensions not allowed as attachment, for example .7z.

My suggestion on extensions is just to disallow file names ending with .exe while uploading, otherwise allow the attachment, don't interpret what is the extension, don't look into the bytes of attachment. Maintain byte-for-byte of the upload. The extension can however be used to set the Content-Type of HTTP header when a forumer wants to download the attachment. But the Content-Type setting should be minimal, only for .png, .jpg, .gif, .txt, for example. Other files should be just octet stream.

This post has been edited by xenon: Aug 11 2007, 08:31 AM


Attached image(s)
Attached Image

Attached File(s)
Attached File  430787_zip_test.zip ( 10.67k ) Number of downloads: 32
wKkaY
post Aug 11 2007, 05:27 PM

misutā supākoru
Group Icon
Admin
5,907 posts

Joined: Jan 2003
1) The easy fix for the thumbnail is to not watermark the images. That is se7en's decision. Extra code can be added to repack the watermarked image as a PNG, but JPEG is acceptably fine, really.

2) Gzip encoding problems will be fixed once we get the new server. Right now there's too many layers contributing to the problem.

3) I don't see any incentive to change the filename restrictions, especially one that proposes a change from the current "default deny" policy to a "default allow" one, so they'll remain unchanged.
sHawTY
post Aug 11 2007, 06:41 PM

Frequent Reporter
********
All Stars
11,846 posts

Joined: Jul 2005

QUOTE(xenon @ Mar 24 2007, 07:54 AM)
I don't like watermark.
*
Who are you to say that?
The owner of this forum? laugh.gif
wKkaY
post Sep 15 2007, 08:39 PM

misutā supākoru
Group Icon
Admin
5,907 posts

Joined: Jan 2003
OK, the zipfile corruption problem should be resolved now.
TSxenon
post Sep 15 2007, 11:32 PM

On my way
****
Senior Member
501 posts

Joined: Jan 2005
From: Selangor

erm, not yet?
http://forum.lowyat.net/topic/519506

 

Switch to:
| Lo-Fi Version
0.0385sec    1.36    6 queries    GZIP Disabled
Time is now: 16th November 2019 - 01:46 AM