Comments (5)
I've done few tests but I couldn't reproduce the issue. May be race condition? I think, it could be reproducible with multiple concurrent same requests.
from kirby.
I've noticed this on different servers (production and localhost) and with different image sizes (small and large). We have this custom code to generate small image thumbs we use as placeholders:
public function previewUri()
{
try {
[$width, $height] = $this->dimensions();
$height = round((65 / $width) * $height);
$width = 65;
if ($this->crop) {
$options = null;
if ($this->crop !== 'focus') {
$options = [
'crop' => $this->crop
];
}
$thumb = $this->file->crop($width, $height, $options);
} else {
$thumb = $this->file->thumb([
'width' => $width,
'height' => $height
]);
}
if (!$thumb->exists()) {
$thumb->save();
}
return F::uri($thumb->root());
} catch (Exception $e) {
return '';
}
}
Not sure if this might be a source of this issue, too. Still, the persistent job files do not only affect these thumbs but other images as well.
from kirby.
I also noticed that sometimes there are just unchanged copies of the original image in the media folder (same file size, same dimensions):
We are also seeing high CPU usage and failures. Although we are using GD for image creation, this might be related to #5328.
from kirby.
I also noticed that sometimes there are just unchanged copies of the original image in the media folder (same file size, same dimensions):
I'm pretty sure that you already know this, but I think you may have overlooked it. This behavior is possible if the original image is used in the content or a original url is provided for the lightbox (as in the example below). Of course, I'm making an assumption since I don't know your case. In the example below, the original image is not copied to the media folder unless the lightbox is running to enlarge the image.
<a href="<?= $cover->url() ?>" data-lightbox class="img">
<img src="<?= $cover->crop(1200, 600)->url() ?>" alt="<?= $cover->alt()->esc() ?>">
</a>
from kirby.
@afbora You are right about the directly linked sources (and you are totally right, that I overlooked that, too). So this is just fine 👍
We are still left with the persisting job files. My guess is something did not work as expected while generating thumbs. Let this either be a memory or CPU limit or some kind of other fault on the server. So do coexisting job and thumb files imply that something is wrong with the generated thumb? Let's say the thumb is only partly rendered. This is an important question because if this is the case, the thumb should be regenerated on next call, discarding the existing thumb. But this could cause more trouble if the server was already at its limits forcing recursive image generations. If – on the other hand – an existing thumb predicates that the image generation finished correctly (because it was only moved from tmp
to the media
folder after generation, I don't know), then the persisting job file could savely be removed on second call.
The question is which is right and which is wrong: the existing job or image files?
from kirby.
Related Issues (20)
- [Panel] Dragging a file from a file section into a writer field stores the panel file url HOT 1
- [Panel] Long page title pushes the prev/next page navigation out of view HOT 3
- Resize/crop/thumb functions see longest size of images as width HOT 5
- [Panel] Switching Languages triggers revert / save HOT 1
- Use `slugs.maxlength` when generating slugs HOT 1
- `convert` command deprecated
- Slower navigation requests still go through even if already navigated elsewhere
- Files & Pages field: singular empty text when multiple: false HOT 2
- Media file not deleted after status change HOT 1
- Table layout pages section: interactive previews are not updating content HOT 1
- [Panel] Pattern setting is ignored in some cases HOT 4
- Classes added by Custom Nodes are stripped out of the Writer field when refreshing the page/ProseMirror re-rendering the Writer HOT 2
- Performance issue: slow pages section with table layout
- Sorting doesn't work as expected if some pages have fixed nums HOT 5
- Page creation dialogue: "add" button is no longer displayed [regression] HOT 1
- IDE support for `Filesystem\Asset` proxied methods HOT 2
- Focus on Blocks is not removed when focus switches to other field
- Change URL dialog: not displaying language URL prefix
- `Html::tag` does not accept whitespace for attributes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kirby.