Hey everyone,
When uploading images, there is regularly an error message, but in the end, the image is still uploaded. Unfortunately I have no idea where to look at. In my local dev environment I can’t reproduce this error. Thanks for helping!
What does the error say in English?
The error message says “The file … cannot be found”.
@alex-irschfeld Do you have any plugins installed or hooks set up?
Thanks for your replies! @jimbobrjames @lukasbestle
I’m using this Kirby 3 Fingerprint plugin
And only one hook which I’m using for toggle the status between draft and unlisted with a toggle field for all child pages:
'hooks' => [
'page.update:after' => function ($newPage, $oldPage) {
// Check if it's the "artists" or "program" page
if ($newPage->slug() === 'artists' || $newPage->slug() === 'program') {
$toggle = $newPage->childStatusToggle()->toBool();
foreach ($newPage->childrenAndDrafts() as $child) {
if ($toggle) {
// Set child pages to 'unlisted'
$child->changeStatus('unlisted');
} else {
// Set child pages to 'draft'
$child->changeStatus('draft');
}
}
}
},
]
Thank you, neither the plugin nor the hook should cause this directly.
Which Kirby version are you using? Does the error appear directly after the upload or is there user interaction in between (such as clicking on the uploaded image)?
Thank you, @lukasbestle , for your reply. I double-checked with the client because at first, I could not reproduce the error. Now I know that it happens when an image is already present and is being replaced.
FYI: I have a file blueprint where every image is converted into the webp format.
Could this be causing the issue?
That could indeed be related.
Do I understand it correctly that the following happens:
- An image
example.webp
already exists. - The user replaces that image with a JPEG (for example).
- On upload, Kirby automatically converts it to WebP, so again the file is
example.webp
. - Immediately after the conversion, the user gets to see the error message that the WebP file could not be found.
Correct?
@lukasbestle
That is correct so far, with the exception that the new image is converted into a WebP format but retains its name. So:
- An image example1.webp already exists.
- The user replaces that image with a JPEG (for example, example2.jpg).
- On upload, Kirby automatically converts it to WebP, so the file becomes example2.webp.
- Immediately after the conversion, the user sees the error message that the WebP file could not be found.
Thanks, I’ll try to reproduce this tomorrow.
Edit: Sorry, didn’t get to it so far but haven’t forgotten about it, thanks for your patience.
I need to ask again which Kirby version you are using. I have tested this with Kirby 4.4.1 and got the following result when trying to replace an existing image:
- To replace the WebP file, I could only select other WebP files, not JPEGs.
- After upload, Kirby uses the same filename as the original replaced image, not the filename of the new file.
Thanks for looking after it!
It’s version 4.2.0.