Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

source images get deleted #12

Closed
bnomei opened this issue May 3, 2017 · 5 comments
Closed

source images get deleted #12

bnomei opened this issue May 3, 2017 · 5 comments
Assignees
Labels

Comments

@bnomei
Copy link

bnomei commented May 3, 2017

using most current imagekit and imageset.

if have a couple of imageoptim optimized files. but i also have jpg optimizers setup in config file.
the result is since my source files are smaller than on server optimized the source files get deleted!

why is that?

protected function keepSmallestFile($target, $alternative) {

@fabianmichael
Copy link
Owner

By source files, do you means the originals inside of the content folder?

What optimizers are activated in you config file?

Regarding the linked piece of code: When testing optimizers, I realised that sometimes the resulting »optimized« version of a file is bigger than the input file. Some optimizers can handle that and only override a file, when the optimization was able to reduce file size. But some don’t offer this ability, so I decided to check this in PHP.

@fabianmichael fabianmichael self-assigned this May 4, 2017
@bnomei
Copy link
Author

bnomei commented May 5, 2017

yes. it deletes one JPG image file out of the content folder for each time i try to call imagekits widget. it seems to crash after the first image once the original (content folder file) gets removed (which it should not ever).

c::set('imagekit.optimize', true);
c::set('imagekit.gifsicle.bin', 'PATH/gifsicle-linux');
c::set('imagekit.jpegtran.bin', 'PATH/jpegtran-linux');
c::set('imagekit.optipng.bin',  'PATH/optipng-linux');
c::set('imagekit.pngquant.bin', 'PATH/pngquant-linux');

@bnomei
Copy link
Author

bnomei commented May 5, 2017

it seems it has nothing to do with optimizers after all. if the colorthief lib gets caught in a execution timeout the file process gets removed. yes, thats imageset actually not imagekit – i know.

c::set('imageset.placeholder', 'color');

Error on
plugins/imageset/vendors/ColorThief/Image/Adapter/ImagickImageAdapter.php on line: 85

@fabianmichael
Copy link
Owner

Okay, I had a more in-depth look at the code and added an additional check before calling ColorThief.

I’ve created a new branch for that in the ImageSet repo, please check if it now works for you, because I could not replicate your error: https://github.com/fabianmichael/kirby-imageset/tree/source-images-deleted-error

Thanks for your help!

@bnomei
Copy link
Author

bnomei commented May 11, 2017

I could not replicate my error it with this new tree. Thanks!

@bnomei bnomei closed this as completed May 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants