Skip to content

Remove suffix from converted full size images.#7748

Closed
peterwilsoncc wants to merge 28 commits into
WordPress:trunkfrom
peterwilsoncc:fix/62359-no-dimension-suffix-converted-img-type
Closed

Remove suffix from converted full size images.#7748
peterwilsoncc wants to merge 28 commits into
WordPress:trunkfrom
peterwilsoncc:fix/62359-no-dimension-suffix-converted-img-type

Conversation

@peterwilsoncc

@peterwilsoncc peterwilsoncc commented Nov 7, 2024

Copy link
Copy Markdown
Contributor

Remove the dimension suffix from the full size image when converted to a web safe type.

This prevents the full size image file names from having the same form as a sub-sized image, filename-widthxheight.ext. Instead the file name uses the original name with the new extension.

Includes tests from #7733 but modified to use HEIC for the conversion source.

Trac ticket: Core-62359

@github-actions

github-actions Bot commented Nov 7, 2024

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props mukesh27, peterwilsoncc, azaozz, apermo, flixos90, ironprogrammer.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Nov 8, 2024

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Comment thread tests/phpunit/tests/media.php Outdated
Comment thread tests/phpunit/tests/functions.php Outdated
Comment thread src/wp-admin/includes/image.php

@apermo apermo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one WPCS issue.

Comment thread src/wp-admin/includes/image.php Outdated

@felixarntz felixarntz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterwilsoncc This looks great to me, thanks for working on this.

I have one question, but I trust the tests passing over my question, so I'll already approve.

Comment thread src/wp-admin/includes/image.php Outdated
@azaozz

azaozz commented Nov 8, 2024

Copy link
Copy Markdown
Contributor

Just tested this again (manually) and all seems to work properly.

  • The name of the originally uploaded HEIC image is preserved after converting it, only the extension is different.
  • If a file with the target name already exists, the name of the uploaded image is properly incremented. I.e. if image.jpg already exists in the uploads directory, and the user uploads image.heic, the latter is saved as image-1.heic, and all resulting sub-sizes and/or converted images have the -1 suffix.

@ironprogrammer ironprogrammer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @peterwilsoncc! Just a couple quick nits here.

Comment thread tests/phpunit/tests/media.php Outdated
Comment thread tests/phpunit/tests/media.php Outdated

@mukeshpanchal27 mukeshpanchal27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @peterwilsoncc ♥️

peterwilsoncc and others added 2 commits November 10, 2024 08:37
Co-authored-by: Brian Alexander <824344+ironprogrammer@users.noreply.github.com>

@mukeshpanchal27 mukeshpanchal27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit-pick. Not blocking add end period in message.

Comment thread tests/phpunit/tests/media.php Outdated
Comment thread tests/phpunit/tests/media.php Outdated
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
@peterwilsoncc

Copy link
Copy Markdown
Contributor Author

Merged r59379 / e1f052e

Thanks all for helping get this over the line.

@peterwilsoncc peterwilsoncc deleted the fix/62359-no-dimension-suffix-converted-img-type branch November 10, 2024 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants