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

Fixed query_images() for compatibility with Plugin "WP-Offload-S3" #35

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

itinance
Copy link

If the plugin "WP-Offload-S3" is installed, the attachments are stored at AWS S3 and are available either per S3 or via AWS Cloudfront and not necessarily hosted on the server being available at ABSPATH.
In this case, file_exists() will check the wrong filepath here.
In my PR i'm checking the hostname of the image URLs again the hostname of the wordpress installation and, if they are different, i just pass the information from wp_get_attachment_image_src(), which contains the full path to S3/Cloudfront, and renounce calls to file_exists() and getimagesize().

I reverted the first commit because i forgot to create a branch first.

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.

1 participant