Skip to main content

Migrate Process Remote Image Check

Submitted by daniel on

This module provides a Migrate process plugin to enable you to check whether a migrated remote image url/string is in fact a valid address for a media asset such as an image. It does this by requesting each image and see if it returns a valid response.

If this fails, it will attempt to remove any query string to that has been appended to an image to see if removing this helps to generate a successful response.

If the response is not ok, it will fallback to using an empty string so as to avoid any exceptions when trying to migrate the remote image asset.

Additionally, this plugin allows a migration to strip the query string by default on asset urls if desired.

Background

There are a number of gotchas when handling remote assets, in particular remote images. I have identified the following scenarios:

  1. Remote image is not a valid url as defined by FILTER_VALIDATE_URL
  2. Remote image is relative not absolute
  3. Remote image is referencing localhost e.g. http:///
  4. Some remote images with query strings render while other's don't (see examples below)
  5. On occassion, the url is simply malformed, which is beyond our control

https://www.drupal.org/project/migrate_process_remote_image_check

Date Created
1 year 2 months ago