Make WordPress Core

Opened 8 months ago

Closed 8 months ago

Last modified 8 months ago

#61423 closed defect (bug) (invalid)

Issue with returned url on wp_get_attachment_image_src using FSE

Reported by: n0th's profile n0th Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.5.4
Component: Media Keywords:
Focuses: Cc:

Description

Dear all

When you use the function wp_get_attachment_image_url on a FSE theme it turns out that when it returns the url and the image has the typical size information, the ‘x’ that separates the sizes is not the letter ‘x’, it is a multiplication symbol. They look the same but are not, which makes the address completely useless.

Expected behavior

Receive same information from a function does not matter the type of theme used.

Actual behavior

If you have a classic theme the output its ok, if you use a FSE theme the output its different.

Steps to reproduce

1.- Activate a FSE theme (Twenty Twnety-Four for example.
2.- Use the function to recevi thumbnails url for a resize image.
3.- Put the url receive into the browser to check that it does not exists due the x symbol.

Change History (7)

This ticket was mentioned in Slack in #core-test by mathieulamiotwpmedia. View the logs.


8 months ago

#2 @mathieulamiotwpmedia
8 months ago

Reproduction Report

Description

The reported issue could not be reproduced.

Environment

  • WordPress: 6.5.4
  • PHP: 8.1.23
  • Server: nginx/1.16.0
  • Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.1.23)
  • Browser: Chrome 125.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Three 1.4
  • MU Plugins: None activated
  • Plugins:
    • Code Snippets 3.6.5.1
    • Test Reports 1.1.0

Actual Results

  1. Links retrieved from wp_get_attachment_image_url are valid, with the letter x, and not the multiplication sign.

Additional Notes

  • Tested with Code Snippet plugin, with the following snippet:
$imgid = 23;
$imgurl = wp_get_attachment_image_url( $imgid, 'medium' );
error_log('Test MLT: '. $imgurl);

It always returned URLs like:

[13-Jun-2024 10:29:00 UTC] Test MLT: http://wceu-2024-test.local/wp-content/uploads/2024/06/profil_picture_Vienne_2023-255x300.jpeg
  • Tested with 'full','large','medium','small' image size as parameters.
  • Tested on themes: Twenty Twenty Four, Twenty Twenty Three, Twenty Twenty Two.
  • From the debug.log file, I copy/pasted the URL in a browser and got the picture displayed.

#3 @n0th
8 months ago

Oh! Can you try with wp_get_attachment_image_src ?

#4 @mathieulamiotwpmedia
8 months ago

I get the same results, it's working well on my side. Maybe I am missing something?
Here is the snippet I used:

$imgid = 23; //need to get it dynamically
$imgurl = wp_get_attachment_image_src( $imgid, 'medium' ); //use custom set size
error_log('Test MLT: '. $imgurl[0]);

I don't expect much differences between wp_get_attachment_image_src & wp_get_attachment_image_url based on wp_get_attachment_image_url code (see https://developer.wordpress.org/reference/functions/wp_get_attachment_image_url/)

This ticket was mentioned in Slack in #core-test by mathieulamiotwpmedia. View the logs.


8 months ago

#6 @n0th
8 months ago

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

I think im the one missing something, sorry and thank for your help.

#7 @desrosj
8 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.