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

A possible workaround for issue #859 #860

Closed
wants to merge 1 commit into from

Conversation

jcogs-design
Copy link

This provides a slightly more tolerant response to allow_url_fopen being closed on a server than throwing an exception and baling out.

The proposed approach still traps for the status of the allow_url_fopen option, and if it is available uses the prior data:// method. If it is not available, and the source image is not a Tiff file, it writes a low quality version of the image to a temporary file on disk, and uses this as the target for exif_read_data() and then once data is read deletes the temporary file.

The code works in testing here.

Note, this approach is a demonstration of an alternative approach rather than a proposal for a definitive solution, in that it uses GD2 functions and so does not handle Tiff images. But presumably if the concept is viable the code could be generalised to work with any of the image libraries supported by Imagine.

I'm not so familiar with automated testing, so not able to provide a test for this change. Apologies.

This provides a slightly more tolerant response to `allow_url_fopen` being closed on a server than throwing an exception and baling out.

The proposed approach still traps for the status of the `allow_url_fopen` option, and if it is available uses the prior `data://` method. If it is not available, and the source image is not a Tiff file, it writes a low quality version of the image to a temporary file on disk, and uses this as the target for `exif_read_data()` and then once data is read deletes the temporary file.

The code works in testing here.

Note, this approach is a **demonstration** of an alternative approach rather than a proposal for a definitive solution, in that it uses GD2 functions and so does not handle Tiff images. But presumably if the concept is viable the code could be generalised to work with any of the image libraries supported by Imagine.
@mlocati
Copy link
Collaborator

mlocati commented Jul 30, 2024

I prefer the approach of #861

@mlocati mlocati closed this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants