wordpress-mobile / gutenberg-mobile

Mobile version of Gutenberg - native iOS and Android
GNU General Public License v2.0
243 stars 56 forks source link

Add photo credit as caption when adding an image from Free Photo Library #1609

Open iamthomasbishop opened 4 years ago

iamthomasbishop commented 4 years ago

On Calypso, if you add an image from Free Photo Library (aka Pexels), a caption is added, giving deserved photo credit/attribution.

On calypso:

B7C6D1FE-A87F-46EF-86B1-84E747BCFE18

Note: I thought we had this on Aztec at one point, but I’m not seeing that happen when adding from FPL.

fluiddot commented 3 years ago

As far as I checked, it would be enough just by passing the caption value that is already being fetched when selecting the image to Gutenberg.

Implementation on each platform

iOS

In this case we could just add the caption field when creating the MediaInfo object in WordPress/Classes/ViewRelated/Gutenberg/Utils/GutenbergStockPhotos.swift.

Android

Here it's going to be a bit tricky because it implies to modify the Stock Media store in FluxC.

As far as I checked, the payload from the response contains a field with extra information (including the caption) about the photo in JSON format. My plan would be:

  1. Get the mGuid field from the payload.
  2. Parse the JSON content and extract the caption field.
  3. Add the caption value when creating the StockMediaItem object.