Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documented CImage programmatic flow fails because of missing FastTrackCache dependency #185

Open
lorenzos opened this issue Dec 10, 2021 · 0 comments

Comments

@lorenzos
Copy link

lorenzos commented Dec 10, 2021

I needed to use CImage class API to make and cache thumbnails programmatically, and I found the useful "How it all works" page on the website. That page shows an example flow that I think it always fails because of missing FastTrackCache dependency.

I looked at the FastTrackCache-related code, and I had the impression that it was once optional; now it seems that CImage doesn't work without it: the programmatic flow, as shown, fails with a NPE here. Am I wrong?

Looking at img.php here, here's how I fixed the programmatic flow:

$cachePath = '/my/cache/path/';
$fastTrackCachePath = $cachePath . 'fasttrack/';
@mkdir($fastTrackCachePath, 0777);
$fastTrackCache = new CFastTrackCache();
$fastTrackCache->setCacheDir($fastTrackCachePath)->enable(true)->setFilename(['no-cache', 'nc']);

// https://cimage.se/doc/cimage-api
$cimage = new CImage();
$cimage->useCache(true)->setSaveFolder($cachePath)->injectDependency("fastTrackCache", $fastTrackCache);
// ...etc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant