View Issue Details

IDProjectCategoryView StatusLast Update
0002052Composrcorepublic2018-04-02 18:51
ReporterChris GrahamAssigned ToChris Graham 
SeverityFeature-request 
Status resolvedResolutionfixed 
Product Version 
Fixed in Version 
Summary0002052: Formal implementation for cleanup of uploaded images
DescriptionWhen images are uploaded, put them through a cleanup pipeline:
 - Fix image rotation, so EXIF-unaware browsers don't struggle (currently exists, make it an option)
 - Apply extra lossless compression to images (only if a optipng path is configured, and it should be autodetected by the option if it is available)
 - Convert non-websafe image formats if Imagemagik is available (psd files, bmp files, tiff files) [image upload fields will need to then be allowed to take in these file types]
 - Fix gamma issues (if we can do this? Also make it an option)
 - Resize to specific required size (option: auto-resize if needed)
 - Resize to maximum size
TagsType: Usability (major)
Time estimation (hours)15
Sponsorship open

Relationships

related to 0001318 non-assigned Watermarking, save unwatermarked 
related to 0003575 non-assigned Support 'transcoding' non-websafe uploaded images formats 
related to 0003576 non-assigned Support deep PNG compression 

Activities

Chris Graham

2018-02-21 18:42

administrator   ~0005530

Last edited: 2018-02-21 18:56

View 2 revisions

adjust_pic_orientation (via constrain_gallery_image_to_max_size) is currently not being called for mass-uploaded gallery images. That should happen, but may need to happen in a task due to it being intensive.

It also won't be called if the image doesn't exceed the maximum size.

Chris Graham

2018-02-21 18:44

administrator   ~0005531

Last edited: 2018-02-21 18:51

View 2 revisions

Also note this:
https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation
https://www.w3.org/Bugs/Public/show_bug.cgi?id=25508#c27
https://bugs.chromium.org/p/chromium/issues/detail?id=158753

Firefox has implemented, nobody else has. Chrome is arguing it is standardised badly, and possibly pushing to make it default to on and possibly make it controlled via an HTML attribute.

Chris Graham

2018-04-01 01:56

administrator   ~0005646

Last edited: 2018-04-01 01:57

View 2 revisions

Some research on file types...
I think the only non-websafe formats we don't currently support are:
 - BMP
 - TIFF

BMP will be supported in v11, as it was added to PHP recently (for PHP builds that support it). It's not very important though as MS Paint has used .png as the default file type since at least Windows 7.

TIFF is not web-safe, and not supported by GD. And it is used widely in cameras. It would be nice to be able to auto-convert that.

I don't think any people are going to casually upload PSD files and expect them to display.

Chris Graham

2018-04-01 02:51

administrator   ~0005647

Some research on gamma correction for PNG files...

Gamma shows worse in:
 - All versions of Safari (up to Safari 11.1, the latest)
 - IE9 and lower

Firefox, Chrome, and IE10+ seem generally consisten with each other.

I don't think they ignore gamma, but they interpret it differently (cumulative vs ignore vs override?). It's hard to say what is correct.
There are 2 issues:
1) Inconsistency between browsers
2) Inconsistency between CSS colours and image colours, which are meant to be in the same colour space

There's a good test image in:
https://superuser.com/questions/579216/why-does-this-png-image-display-differently-in-chrome-firefox-than-in-safari-a

On Mac, Preview shows the same as Safari. Pixelmator shows the same as Firefox/Chrome/IE10+.

The best solution is to just strip gamma, as it's unlikely we even care about the system gamma saved into an image.

Just opening and resaving the image in PHP/GD effectively strips the gamma:
$img = imagecreatefrompng('VhGrd.png');
imagepng($img, 'VhGrd3.png');

Chris Graham

2018-04-02 01:37

administrator   ~0005650

I mostly have this implemented now, but I'm stripping off 2 parts to separate issues with I'm going to 'relate' to this issue...

1) support other uploaded formats and convert via Imagemagik (bmp, tif/tiff)
2) optipng heavy compression for PNG files

I don't actually care about these things, and they'd add a fair amount of extra work.

Issue History

Date Modified Username Field Change
2018-02-07 18:27 Chris Graham Tag Attached: Type: Usability (major)
2018-02-21 18:42 Chris Graham Note Added: 0005530
2018-02-21 18:44 Chris Graham Note Added: 0005531
2018-02-21 18:51 Chris Graham Note Edited: 0005531 View Revisions
2018-02-21 18:56 Chris Graham Note Edited: 0005530 View Revisions
2018-04-01 01:56 Chris Graham Note Added: 0005646
2018-04-01 01:57 Chris Graham Note Edited: 0005646 View Revisions
2018-04-01 02:51 Chris Graham Note Added: 0005647
2018-04-02 01:24 Chris Graham Relationship added related to 0001318
2018-04-02 01:37 Chris Graham Note Added: 0005650
2018-04-02 01:45 Chris Graham Relationship added related to 0003575
2018-04-02 01:45 Chris Graham Relationship added related to 0003576
2018-04-02 18:51 Chris Graham Status non-assigned => resolved
2018-04-02 18:51 Chris Graham Resolution open => fixed
2018-04-02 18:51 Chris Graham Assigned To => Chris Graham