Closed casvangrunsven closed 1 month ago
Hi there,
Hmmm. It's hard to know without a little more information.
Is this happening on all assets or on a specific file? If its happening on a specific file, are you able to share it here? If you can't share it, does the same issue occur on another website with the blurhash plugin (that is otherwise working normally)?
Hi Tom,
Yes, it is happening on all assets. I just spung op a quick debug file for you. This is what is happening in the file: `
<div><b>blurhash:</b> {{blurhash(props.data.block.image.one())}}</div>
<div><b>blurhash dump:</b> {{dump(blurhash(props.data.block.image.one()))}}</div>
{{ include('_components/image/imageHoverContainer.twig', {
data: {
image: props.data.block.image.one() ??? null,
},
}, withContext = false) }}`
Here's the live website where I output this code: https://quizzical-wu.37-128-148-201.plesk.page/vacatures/monteur When you scroll down a bit until you see the large image, that is where that specific output is.
It does not occur on other websites. For instance, on our website https://codigital.nl/cases the blurhash works, with the same code
Hmmm, ok.
If it's happening on all assets then it sounds like it may be a server configuration issue. At this point I would start looking at the Craft or PHP logs for any clues...
Did you have any luck discovering the issue?
I'm going to close this as it is not a reproducible bug and is likely related to server configuration.
Hi Tom,
No, unfortunately not. It seems to be a Craft/DDEV installation issue because when I create a new project, it works. Very strange, cannot resolve it, but indeed not a plugin issue I guess...
Met vriendelijke groet,
Cas van Grunsven development
Codigital Bruistensingel 500, 5232 AH 's-Hertogenbosch 073 730 33 20 | 06 108 06 377
On 9 Sep 2024, at 14:52, Tom Kiss @.***> wrote:
Did you have any luck discovering the issue?
I'm going to close this as it is not a reproducible bug and is likely related to server configuration.
— Reply to this email directly, view it on GitHub https://github.com/dodecastudio/craft-blurhash/issues/22#issuecomment-2338045222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIAZPDLRKQUS472M7F5QBODZVWK2XAVCNFSM6AAAAABNWWDWP6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZYGA2DKMRSGI. You are receiving this because you authored the thread.
Hi Tom,
Just want to give an update on this thread, I managed to resolve the issue. It had to do with setting a subpath on the asset volume. When setting a subpath, the blurhash won't render. More specifically, rule 93 un BlurHashService.php: if ( !$asset->getFs()->fileExists($asset->path) )
When removing the subpath in the assets volume, it works.
Maybe it helps with improving the plugin in the feature :)
Nevertheless thanks for your fast response and your help!
Best, Cas
Hi Cas,
Thanks for that, I will take a look :)
OK, that didn't take long.
What you've highlighted here is a general oddity in Craft.
When you add a sub-path setting to an Asset Volume, the setting is saved and applied - but the assets themselves do not move location.
This means that when the asset is next requested, in a template or in the admin panel, the image will 404 because the sub-path is rendered in its URL but the asset has not been moved to the location. It's a mismatch between the database and the filesystem.
For example, if I upload an image in Craft, then edit the subpath, the next time I try to view the image in the Assets view, it will not render as it has not yet been moved to the sub path location:
(In the example above, the image is only rendered in areas of the UI where it's already been cached).
If you set the sub-path, then upload an asset, it will render the blurhash, as it has been uploaded to the location with the sub-path. If you then remove the sub-path, it will no longer render. As a blurhash, or as an image.
Make sense?
As this is an more an issue around sub-path within Craft I will be closing the issue. I can't really do anything about this on the plugin side.
I'm also seeing this issue. We've got our assets on Servd where subpaths are required. I haven't tested but perhaps fs->fileExists
only returns true for local files.
I had subpaths set, then uploaded some assets but I still see this issue
Hmmm, I tend to mostly use Google Cloud Platform so CDN hosted assets should not be an issue. I'll need to figure out how to test with Servd at some point, I have some projects on there but don't use the assets feature.
Thanks Tom, happy to help debug or help any way I can. Would you be open to adding a setting to allow us to bypass the file exist check, or maybe just fail silently instead of throwing the exception as per #8 ?
@chrisrowe Sure thing, that seems like a good idea. I've pushed that out in a new v3.0.1 release, let me know how you get on.
To make use of it, add the following to your config/blur-hash.php
config file (full example):
<?php
return [
'checkFileExists' => false,
];
You can see where this is used in the source file here.
What a gent! Took a few mins to realise it wasn't config/blurhash.php
I guess it uses the plugin handle (maybe rename the example file to blur-hash-config.php
) but after that it's perfect, thanks so much!
Doh, yes sorry, bad typo there!
Hi,
I've been using your plugin for years, but now in a new project, in some way or another, it is not returning a blurhash anymore. This is the piece of code:
{% set testAsset = craft.assets().id(1211).one() %} {{dump(blurhash(testAsset))}}
I tried, everything, from just putting the asset, and this one with your example by querying it explicitly with the ID. Nothing is working.
It returns 'false' when I try to dump the blurhash.
Do you have any clue?
Thanks in advance!
Best, Cas