#33011 closed enhancement (fixed)
Uploading a 512 x 512 site icon creates a duplicated image in the media library
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | normal | Version: | 4.3 |
Component: | Administration | Keywords: | has-patch |
Focuses: | Cc: |
Description
When a site icon is uploaded that is 512px x 512px it shouldn't be cropped by the system. The system should see it's the correct size and not duplicate it. The file size is also exactly the same the only difference is now you have a duplicate of the file with copy at the front.
Attachments (3)
Change History (17)
#1
@
10 years ago
- Keywords dev-feedback added
- Milestone changed from Awaiting Review to 4.3
- Owner set to obenland
- Status changed from new to assigned
- Summary changed from Site Icon to Uploading a 512 x 512 site icon creates a duplicated image in the media library
#2
follow-up:
↓ 3
@
10 years ago
Did you test it in the Customizer or the Settings version?
I wouldn't be surprised if in the Customizer they duplicate it to not stomp on the original image once it was set as a header/background/site-icon. I'd also have to find out if the media modal passes on whether the file was just uploaded or was pre-existing, so the cause could also be a lack of information.
#3
in reply to:
↑ 2
@
10 years ago
Replying to obenland:
Did you test it in the Customizer or the Settings version?
I originally only tested in the customizer, tested just now via settings, the same results where lego-minifigure-catalog-icon-512.png
was the original 512 x 512 file, this just as my previous example above was/is a new file that was not previously in the media library, a fresh upload:
-rw-rw-r-- 1 netweb staff 20K Jul 18 07:17 copy-lego-minifigure-catalog-icon-512-150x150.png -rw-rw-r-- 1 netweb staff 25K Jul 18 07:17 copy-lego-minifigure-catalog-icon-512-180x180.png -rw-rw-r-- 1 netweb staff 28K Jul 18 07:17 copy-lego-minifigure-catalog-icon-512-192x192.png -rw-rw-r-- 1 netweb staff 43K Jul 18 07:17 copy-lego-minifigure-catalog-icon-512-270x270.png -rw-rw-r-- 1 netweb staff 50K Jul 18 07:17 copy-lego-minifigure-catalog-icon-512-300x300.png -rw-rw-r-- 1 netweb staff 2.6K Jul 18 07:17 copy-lego-minifigure-catalog-icon-512-32x32.png -rw-rw-r-- 1 netweb staff 39K Jul 18 07:17 copy-lego-minifigure-catalog-icon-512-512x270.png -rw-r--r-- 1 netweb staff 76K Jul 18 07:17 copy-lego-minifigure-catalog-icon-512.png -rw-rw-r-- 1 netweb staff 20K Jul 18 07:17 lego-minifigure-catalog-icon-512-150x150.png -rw-rw-r-- 1 netweb staff 50K Jul 18 07:17 lego-minifigure-catalog-icon-512-300x300.png -rw-rw-r-- 1 netweb staff 39K Jul 18 07:17 lego-minifigure-catalog-icon-512-512x270.png -rw-rw-r-- 1 netweb staff 76K Jul 18 07:17 lego-minifigure-catalog-icon-512.png
Replying to obenland:
I wouldn't be surprised if in the Customizer they duplicate it to not stomp on the original image once it was set as a header/background/site-icon.
Per the above it's not isolated to the customizer.
Replying to obenland:
I'd also have to find out if the media modal passes on whether the file was just uploaded or was pre-existing, so the cause could also be a lack of information.
I think your onto something here, thanks for taking a look :)
#4
@
10 years ago
Any news on this? What would be the expected behavior and why? Where dos Site Icon behave differently from Headers or Backgrounds?
#5
@
10 years ago
Hi,
Expect behavior for me is this:
A file that is uploaded at 512x512 shouldn't be duplicated at that size. The reason for this is, it's duplicating a size that already exists.
What would be a nifty little feature is, it ignores the re-sizing of image_size and only creates the site icon sizes.
Does that answer your question?
#6
@
10 years ago
Here's my take with the caveat I've not looked into if this functionality happens in other parts of the media library when uploading files:
Pretty much if I upload a file, per my last example lego-minifigure-catalog-icon-512.png
, I'd then expect some thumbnails be generated based on the intended use case of the file I'm uploading, in this case we're wanting some square images, so generate the default base thumbnails, 150x150, 300x300, 512x270, now we need those additional square thumbnails, generate the 32x32, 180x180, 192x192, and 270x270 thumbnails, for a total of 1 original image and 7 thumbnails, totalling 8 images.
Rather than that above, in the current state we have 12 image files, of which 4 are duplicates.
This is the list of files that I would have expected to exist after uploading an image to be used as a site icon:
lego-minifigure-catalog-icon-512.png lego-minifigure-catalog-icon-512-32x32.png lego-minifigure-catalog-icon-512-150x150.png lego-minifigure-catalog-icon-512-300x300.png lego-minifigure-catalog-icon-512-512x270.png lego-minifigure-catalog-icon-512-180x180.png lego-minifigure-catalog-icon-512-192x192.png lego-minifigure-catalog-icon-512-270x270.png
#7
@
10 years ago
Based on my testing with latest trunk it seems like custom headers make you go through the cropping stage even though the image has the recommended size, resulting in the original image and a cropped version of that image.
For Site Icon that cropping stage is skipped, which results in the custom image sizes not being generated.
#8
@
10 years ago
So I think we'll always have to duplicate the image because we can't be sure whether it was recently uploaded or selected from previously existing images.
This ticket was mentioned in Slack in #core by netweb. View the logs.
10 years ago
#10
@
10 years ago
I cannot reproduce this as of r33352
Tested this 3 times just now, twice uploading a new 512x512 and one at 600x600, the larger gets cropped to 512x512 with files prefixed with cropped-
, the original 512x512 files are used with no duplicates created of file name changes, works as expected.
Also tested header image behaviour, using a 954x1300 header image for Twenty Fifteen, uploading an exact dimension file then this file is used as is, uploading a larger dimension file the image is cropped and prefixed with cropped-
, works as expected.
A changeset overnight that is alluding me has changed the behaviour here per the original report and now everything works as expected for me.
#11
@
10 years ago
- Keywords has-patch added; dev-feedback removed
Patch sends attachments that are the exact size back to cropping and uses the same attachment if it has the site-icon
context.
This will still duplicate the original image, which we can't change to avoid stomping people's images, but it will not create additional images after that.
#12
@
10 years ago
Dusting off the gravatar trick for arbitrary square image generation.
512x512
https://www.gravatar.com/avatar/61ee2579b8905e62b4b4045bdc92c11a?s=512
32x32
https://www.gravatar.com/avatar/61ee2579b8905e62b4b4045bdc92c11a?s=32
Testing: The original file uploaded was
bDkmXyEmr5.png
512 x 512 and the uncropped file is created prefixed withcopy-
along with the extra thumbnails.Can we not just use the original 512 x 512 file uploaded and generate the extra thumbs needed?