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

Allow filtering of the image URL prior to generating image tags and alternate text #217

Merged
merged 4 commits into from
Jul 24, 2020

Conversation

petenelson
Copy link
Contributor

Description of the Change

In instances where an image has been offloaded to a CDN, running the image CLI command is failing. This command calls generate_image_alt_tags(), which calls get_largest_acceptable_image_url(), which requires an image to be physically present on the server. If the image is not present, the image URL is null and no tags or alternate text can be generated.

Alternate Designs

None

Benefits

This pull request adds a filter to allow overriding of the image URL which can allow the Computer Vision API to pull the image directly from a CDN.

Possible Drawbacks

None

Verification Process

No verification was performed.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

  • Added classifai_generate_image_alt_tags_source_url filter to allow overriding of the image URL within generate_image_alt_tags()

@jeffpaul jeffpaul requested a review from dinhtungdu July 17, 2020 15:48
@jeffpaul jeffpaul added this to the 1.6.0 milestone Jul 17, 2020
@jeffpaul
Copy link
Member

This may resolve #201, but testing will be needed to be certain.

…then proceed with meta check if no URL is present
Copy link
Contributor

@dinhtungdu dinhtungdu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

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

Successfully merging this pull request may close these issues.

3 participants