#33417 closed defect (bug) (fixed)
JS error when uploading small image as Site Icon and electing to Skip Cropping
Reported by: | truonght | Owned by: | ocean90 |
---|---|---|---|
Milestone: | 4.3.1 | Priority: | normal |
Severity: | normal | Version: | 4.3 |
Component: | Customize | Keywords: | has-patch |
Focuses: | javascript | Cc: |
Description (last modified by )
I select a _small_ image in Customize > Site identity > Site icon. After selecting the image, I choose “Skip Cropping” and then the modal changes to blank. I see an error in browse console:
Uncaught TypeError: Cannot read property 'url' of undefined
Attachments (2)
Change History (18)
#4
@
9 years ago
- Description modified (diff)
- Focuses javascript added
- Keywords needs-patch added; reporter-feedback removed
- Milestone changed from Awaiting Review to 4.3.1
- Summary changed from Js error when skip sropping to JS error when uploading small image as Site Icon and electing to Skip Cropping
Thank you. I was able to reproduce the issue once I tried a _small_ image.
The error is happening in the SiteIconControl.setImageFromAttachment()
method on this line:
$( 'link[sizes="32x32"]' ).attr( 'href', icon.url );
#6
@
9 years ago
With the current implementation, if there is an image with the size site_icon-32
, it is used. If there is no image with that size, the thumbnail
size is used. In case the image is smaller than thumbnail
, it has only full
size, which we should use in this case. So I suggest that we check for all of these sizes and finally the full
size for this edge case. Patch coming up soon.
@
9 years ago
Customizer Site Icon: SiteIconControl.setImageFromAttachment() - properly handling smaller image sizes when cropping step is skipped.
#8
@
9 years ago
I'd like to propose a different approach, requiring users to always crop the icon.
We need the icon to be square anyway, otherwise they're displayed distorted which is not a good user experience either.
#10
follow-up:
↓ 15
@
9 years ago
- Keywords needs-testing removed
My two cents: I believe we should allow the user to skip the cropping step. There is no reason to require the cropping IMHO - why not allow the image to remain untouched? There are many cases when the user has prepared a special image for the site icon, and they would want it to remain uncropped.
Also, concerning 33417.diff, it does not fix the issue for me. I haven't made a research, but I guess that mustBeCropped
is not fully implemented yet.
I've just tested my patch again, it fixes this issue and the "Skip Cropping" button works exactly as it should.
This ticket was mentioned in Slack in #core-customize by sam. View the logs.
9 years ago
#15
in reply to:
↑ 10
@
9 years ago
Replying to tyxla:
There is no reason to require the cropping IMHO - why not allow the image to remain untouched? There are many cases when the user has prepared a special image for the site icon, and they would want it to remain uncropped.
There are two reasons to force cropping, being able to generate the correct image sizes for app icons and making sure the image is actually square.
If 33417.diff didn't fix your issue we should see what the problem is and fix it rather than just patching over an error.
@truonght Thanks for the report. I tried reproducing your steps, but I do not even see there being a “Skip Cropping” option after having selected an image.