WordPress.org

Make WordPress Core

Opened 8 months ago

Last modified 4 months ago

#48784 reopened defect (bug)

Search box in Select / Upload image pop-up not working with cropped images

Reported by: javierr Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.3
Component: Media Keywords:
Focuses: ui, javascript, template Cc:

Description

Hi, it seems that the search field in the pop-up of selecting or uploading images can not find the images which have been cropped before. For example, if I go to Appearance / Customize and want to change the Logo image, and I am asked to cropped the image, that image won't show in the search field. It will show the non cropped image, but not the cropped one.
Thank you!
In the attached image you can see how the search field can do find the filename "Foto-de-Javier-1.jpg" using just the letters "jav". But there is another image in the Media which name is "cropped-Foto-de-Javier-1.jpg" and this one does not appear.

Attachments (1)

screencapture-casitanew-lacasitademimbre-wp-admin-admin-php-2019-11-24-21_48_28.png (230.4 KB) - added by javierr 8 months ago.
capture of pop-up of Select or Upload images

Download all attachments as: .zip

Change History (6)

@javierr
8 months ago

capture of pop-up of Select or Upload images

#1 @SergeyBiryukov
8 months ago

  • Component changed from General to Media

#2 @kkarpieszuk
8 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Nice catch! I confirm the issue.

Steps to replicate:

  • clean wordpres installation with default theme
  • login as admin
  • go to wp-admin > apperance > customize > site identity
  • click logo button
  • upload some image from disc and remember its name
  • choose option to add this image
  • you will see image cropping tool. crop the image

What is working:

  • go to wp-admin > Media > Library
  • you will see there your uploaded image and cropped one with 'cropped' on the beginning of the name

What is not working:

  • go again to wp-admin > apperance > customize > site identity
  • remove logo image and publish changes
  • click logo button to choose image
  • you wil not see cropped image in media overlay and search field will not find it (as presented on the screenshot from opening post)

Additional observations:

  • both images are in wp_posts table, with same post type, parent and other fields not suggesting something is different between both images.
  • So something must be wrong with ajax request for the image. I will investigate with xdebug in a moment

#3 @kkarpieszuk
8 months ago

  • Focuses ui javascript template added

I see ajax request for attachments is processed in wp-admin/includes/ajax-actions.php function \wp_ajax_query_attachments. And this fuction returns both images.

I need to give up here and leave it to someone more fluent in javascript: it looks like js template engine here is unfiltering this image, but I know nothing about this template engine used here.

#4 @desrosj
8 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Reopening this as it appears to have been closed on accident.

#5 @sabernhardt
4 months ago

Possibly related: #46127 (but not a duplicate)

Note: See TracTickets for help on using tickets.