New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't send title during mediaUploads; Fix: Image Uploads don't use exif title #13193

Merged
merged 1 commit into from Jan 11, 2019

Conversation

Projects
None yet
3 participants
@jorgefilipecosta
Copy link
Member

jorgefilipecosta commented Jan 4, 2019

Fixes: #13136

We are automatically computing the title based on the file name and we send it during media uploads.
If the rest API receives an explicit title like we are sending the explicitly sent title is used instead of an automatic computed one.
Our automatic title computation on the client is very simple and does not use EXIF metadata. While the title computation of the server uses EXIF metadata if it is present and if not it uses the filename following similar logic to what we did on the client.

I think we should remove the title computation from the client because of the following reasons:

  • Removes duplicate logic between server and client, now only the server generates automatic titles.
  • Saves some bytes on each upload.
  • Solves bug #13136 where EXIF titles were not being used.

If a plugin or a block wants a specific title to be used that is still possible, the title can be passed in additionalData object and in this case, the title will be used.

How has this been tested?

Test image:
300 meta

I used drag & drop on the test image to upload it. I pressed edit button on the created image block and I verified on the media modal that the caption was "My caption" and the title was "My title".
I added an image block, and I upload the same image using the upload button and verified the correct title and caption were applied.
I repeated the same tests using media & text and cover block.
I used other blocks with uploads cover, video, audio, file, I upload some files and images without EXIF data and I checked a title was generated based on their name.

@jorgefilipecosta jorgefilipecosta self-assigned this Jan 4, 2019

@jorgefilipecosta jorgefilipecosta changed the title Don't send title during mediaUploads. Fix: Image Uploads don't use exif title Don't send title during mediaUploads; Fix: Image Uploads don't use exif title Jan 4, 2019

@jorgefilipecosta jorgefilipecosta requested a review from WordPress/gutenberg-core Jan 7, 2019

@aduth

aduth approved these changes Jan 9, 2019

Copy link
Member

aduth left a comment

This makes sense to me, and worked well in my testing 👍

@jorgefilipecosta jorgefilipecosta added this to the 4.9 (Gutenberg) milestone Jan 10, 2019

@jorgefilipecosta jorgefilipecosta merged commit 162b4bd into master Jan 11, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jorgefilipecosta jorgefilipecosta deleted the fix/image-uploads-do-not-retrive-title-from-exit branch Jan 11, 2019

@designsimply

This comment has been minimized.

Copy link
Contributor

designsimply commented Jan 23, 2019

I tested this and compared it to WordPress 4.9.8 and verified that the following behavior now matches:

  • if I upload an image with an IPTC Headline and a EXIF Title, the IPTC Headline is used Title
  • if I upload an image with a EXIF Title and no IPTC Headline, the EXIF Title is used as the Title
  • if I upload an image with no IPTC Headline or EXIF Title, the filename is used as the Title

screen shot 2019-01-22 at 10 31 55 pm
Tested with WordPress 4.9.8.

screen shot 2019-01-22 at 10 20 02 pm
Tested with WordPress 5.0.3 Gutenberg 4.9.0-rc.1.

Here are the relevant fields, output using exiftool, from the image file I tested:

File Name                       : PA131082.jpg
Image Description               : this is a campfire
Object Name                     : Campfire
Caption-Abstract                : this is a campfire
Format                          : image/jpeg
Creator Tool                    : Adobe Photoshop Lightroom 6.0 (Macintosh)
Headline                        : IPTC Headline
Title                           : Campfire
Description                     : this is a campfire

I used Lightroom to edit the EXIF and IPTC data before uploading the image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment