Allow adding by photo URL

Created on 10 July 2023, over 1 year ago
Updated 12 April 2024, 8 months ago

Problem/Motivation

Upon using a photo URL the following error appears in the logs:

User notice: utmSource is required as part of API Terms: https://community.unsplash.com/developersblog/unsplash-api-terms-explain... in Unsplash\HttpClient::init() (line 96 of /opt/drupal/vendor/unsplash/unsplash/src/HttpClient.php)

Steps to reproduce

Try to use an unsplash photo URL in the Unsplash ID field.

Proposed resolution

Patch

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡·πŸ‡΄Romania andreic

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @andreic
  • πŸ‡·πŸ‡΄Romania andreic

    Title corrected.

  • πŸ‡·πŸ‡΄Romania andreic

    Patch added.

  • Status changed to Needs work over 1 year ago
  • πŸ‡³πŸ‡±Netherlands batigolix Utrecht

    At the moment the module expects that photos are added using the photo ID.

    You are trying to add a photo using a full URL. Maybe that is the preferred way, but code, UI and docs are not prepared for this.

    We should also improve the UI and readme so that it reflects this way of adding photos.

    Can you add that to the patch?

    I changed the title of the issue to reflect that this is a feature request.

  • πŸ‡·πŸ‡΄Romania andreic

    The existing code takes care of full URL already. Check out src/UnsplashFetcher.php line 54.

  • πŸ‡³πŸ‡±Netherlands batigolix Utrecht

    Indeed. What I meant is that the existing code gives an error when adding the full URL. But your patch will fix this.

    What is missing though are UI and readme changes. This must explain clearly what kind of values (ID, URL, both) are allowed.

  • πŸ‡³πŸ‡±Netherlands batigolix Utrecht
  • πŸ‡ΊπŸ‡ΈUnited States swilmes

    Uploading a new patch that meets the requirements. Slightly different as I noticed normal URLs are no longer in the "/photos/ID" format and now in a "/photos/description-id" format. The earlier paths still work, but just going to a site and clicking a photo gives a different ID. The proposed patch should account for either. I didn't find any ideas that use the "-" character, I think that's by design. If there are some and I just missed them, then this patch won't work.

  • πŸ‡ΊπŸ‡ΈUnited States swilmes

    Apologies, I forgot to include the original utm_source declaration that solves the API logging a notice. Attached patch fixes that issue as well.

  • πŸ‡³πŸ‡±Netherlands EstherTempel

    On a clean Drupal 10.2 installation I have tried patch #10 β†’ .

    I was able to use the full URL to add an image from Unsplash. The description when adding an image explains that you can add an ID or the full URL, both with examples.
    Also the 'Usage' section of the Readme file is updated, where it now also explains that the full URL can be used.

  • Status changed to RTBC 9 months ago
  • πŸ‡³πŸ‡±Netherlands EstherTempel
    • 9a234d18 committed on 1.0.x
      Issue #3373586 by swilmes, andreic, EstherTempel, batigolix: Allow...
  • Status changed to Fixed 9 months ago
  • πŸ‡³πŸ‡±Netherlands batigolix Utrecht
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024