I use the followig code in my template and don’t get the
$thumb = $page->cover()->toFile();
$thumb = $thumb->grayscale();
$thumb = $thumb->resize(500);
$thumb = $thumb->blur(30);
Grayscale is working,
blur not. Imagemagic is activated on server. Any ideas what could help to solve it?
Thanks in advance.
A new file called
blabla-500x-blur30-bw.jpg is generated when I use the code below. but the image is still the original. not resized, no blur, no grayscale
$thumb = $thumb->thumb([
'width' => '500',
'grayscale' => true,
'crop' => false,
'blur' => 30
Do I have to set additional permissions on server which I don’t know about?
I found a solution.
bin pathin config php was wrong.
Removing this line does the job
'thumbs' => [
'driver' => 'im',
'quality' => 90,
// 'bin' => '/usr/local/bin/convert',
'interlace' => true
Your if statement is basically useless, should be
// rest of code
Background: If the field is not empty but the file doesn’t exist despite the field still having a value, your code will fail. On the other hand, if the field is empty, the
toFile() method will return null, so you don’t need two if-clauses.
The reason why your original code did not work is because you cannot modify a thumb again but have to do all changes in one using the thumb() method like you finally did.
Thank you, I will update the like xyou mentioned.
The multiple thumbs on the first entry was just an example. I have also tried this individually.