Fix glide:data_url producing blank output during generation#220
Open
mynetx wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running
ssg:generate, the{{ glide:data_url }}tag outputs nothing and logsUnable to read file from location: …. It only appears to work when a stale copy of the image happens to be sitting in the local glide cache from previously browsing the site.That's because
bindGlide()points the Glide server's cache at the static output directory, so generated images get written there — but the tag reads the image back throughGlide::cacheDisk(), which still points at the defaultstorage/statamic/glidelocation. Write and read disagree, so the read fails.This PR points the glide cache disk config at the same static output location, so anything reading generated images back finds them where the server wrote them.
With
{{ glide:data_url src="/image.png" width="50" }}in a template:The same write/read mismatch is behind several older reports: the
{{ glide }}tag pair reads image dimensions back through the same cache disk (viaAttributes), so with an empty glide cache it errors out (#110, #91, #123) or returns wrong width/height (#148). Verified against this branch: a tag pair that renderswidth="0" height="0"on4.xwith an empty cache renders the correct dimensions with this fix.Fixes #204
Fixes #91
Fixes #110
Fixes #123
Fixes #148