Skip to content
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

Cloning/importing images should assign original alt tag, title, description, and caption to attachment metadata #1344

Closed
4 tasks done
greatislander opened this issue Sep 11, 2018 · 0 comments
Assignees
Milestone

Comments

@greatislander
Copy link
Contributor

greatislander commented Sep 11, 2018

Prerequisites

Description

While cloning or importing, an image with alternative text, title and caption retains this data in the image markup but the metadata is stripped from the media attachment in the library. The description field of the attachment metadata is not reflected in markup, and is lost altogether. This data is exposed in the API, so we can add it to the cloning and import routines.

See: https://guide.pressbooks.com/wp-json/wp/v2/media/2022
(Used in: https://guide.pressbooks.com/wp-json/pressbooks/v2/chapters/1356 )

"title": {
  "rendered": "languageuserprofile"
},
  "author": 84697,
  "comment_status": "closed",
  "ping_status": "closed",
  "template": "",
  "meta": {
  "pb_show_title": "",
  "pb_ebook_start": "",
  "pb_short_title": "",
  "pb_subtitle": "",
  "pb_authors": [],
  "pb_section_license": ""
},
"description": {
  "rendered": "<p class=\"attachment\"><a href='https://pressbooks.com/app/uploads/sites/10270/2016/08/languageuserprofile.png'><img width=\"300\" height=\"159\" src=\"https://pressbooks.com/app/uploads/sites/10270/2016/08/languageuserprofile-300x159.png\" class=\"attachment-medium size-medium\" alt=\"Language setting on the User Profile page\" srcset=\"https://pressbooks.com/app/uploads/sites/10270/2016/08/languageuserprofile-300x159.png 300w, https://pressbooks.com/app/uploads/sites/10270/2016/08/languageuserprofile-768x408.png 768w, https://pressbooks.com/app/uploads/sites/10270/2016/08/languageuserprofile-1024x544.png 1024w, https://pressbooks.com/app/uploads/sites/10270/2016/08/languageuserprofile-65x35.png 65w, https://pressbooks.com/app/uploads/sites/10270/2016/08/languageuserprofile-225x120.png 225w, https://pressbooks.com/app/uploads/sites/10270/2016/08/languageuserprofile-350x186.png 350w, https://pressbooks.com/app/uploads/sites/10270/2016/08/languageuserprofile.png 1069w\" sizes=\"(max-width: 300px) 100vw, 300px\" /></a></p>\n"
},
"caption": {
  "rendered": ""
},
"alt_text": "Language setting on the User Profile page",

Steps to Reproduce

  1. Clone an image with any of title, description, alt text, caption.
  2. View the image in the clone's media library.

Expected behavior: All four metadata are preserved during cloning.

Actual behavior: They are missing except in markup within the post content. Description disappears altogether.

System Information

Pressbooks: 5.5.0-dev

@greatislander greatislander added this to the 5.6.0 milestone Sep 11, 2018
greatislander pushed a commit that referenced this issue Sep 20, 2018
…iption, and caption to attachment metadata (fixes #1344) (#1362)
greatislander pushed a commit that referenced this issue Sep 20, 2018
…e, description, and caption to attachment metadata (fixes #1344) (#1362)"

7ff0006
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants