- First commit to issue fork.
- Status changed to Fixed
about 1 year ago 12:18am 19 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.
When adding an image from Pexels to the external media, its name is the same as the file name.
When using the solution proposed below, it solves the situation for Unsplash, but in Pexels it still does not work.
After investigating a bit, I realized that this is due to the fact that the Pexels API doesn't have a unique field for "description" like Unsplash does.
This way the source media in Pexels is always returning an empty string for the name field. Referenced Code
Taking this into account, my solution to solve this problem is to use the "alt" field as a name/description and only if it is not available, leave an empty string.
return new ExternalMedia(
$data['id'],
$data['src']['original'],
$data['src']['original'] . '?w=800&h=600&fit=crop',
(-) '',
(+) $data['alt'] ?? '',
$data['alt'] ?? '',
$data['photographer'] ?? '',
$data['photographer_url'] ?? '',
);
Note: for this solution to work it is necessary to implement the correction of issue: 🐛 External Media title field is mapped to the file url Closed: won't fix
None.
None.
None.
None.
Fixed
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Automatically closed - issue fixed for 2 weeks with no activity.