Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upDon't send title during mediaUploads; Fix: Image Uploads don't use exif title #13193
+0
−1
Conversation
jorgefilipecosta
self-assigned this
Jan 4, 2019
jorgefilipecosta
added
[Type] Bug
Media
labels
Jan 4, 2019
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
requested a review
from WordPress/gutenberg-core
Jan 7, 2019
aduth
approved these changes
Jan 9, 2019
This makes sense to me, and worked well in my testing |
jorgefilipecosta
added this to the 4.9 (Gutenberg) milestone
Jan 10, 2019
jorgefilipecosta
merged commit 162b4bd
into
master
Jan 11, 2019
1 check passed
continuous-integration/travis-ci/pr
The Travis CI build passed
Details
jorgefilipecosta
deleted the
fix/image-uploads-do-not-retrive-title-from-exit
branch
Jan 11, 2019
This comment has been minimized.
This comment has been minimized.
designsimply
referenced this pull request
Jan 23, 2019
Closed
Image Upload from the Image block fails to import the image title #13136
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
jorgefilipecosta commentedJan 4, 2019
•
edited
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:
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:

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.