creating thumbnails in bolt .

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

creating thumbnails in bolt .

Post by gautamz07 »

I currently have the following lines of code in my index.twig file to output the image of a post:

Code: Select all

<img src="{{ record.image|image }}" alt="">
Now i went through the bolt documentation and came to know that there is the following function in bolt:

Code: Select all

thumbnail(filename, w, h)
https://docs.bolt.cm/3.2/cheatsheet#bol ... ns-in-twig

So now i tried to use the function in the following way:

Code: Select all

<img src="{{ thumbnail(record.image|image, 200, 200)  }}" alt="">
But i get a broken link instead. why is this happening ?
User avatar
Celauran
Moderator
Posts: 6425
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: creating thumbnails in bolt .

Post by Celauran »

What error messages are you getting? Are you saving thumbnails? Is the directory writable?
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: creating thumbnails in bolt .

Post by gautamz07 »

I just get broken links , like so:

http://imgur.com/a/awU2m
Are you saving thumbnails?
@celauran i believe the thumbnails get saved to the thumbs/ folder , i don't see an option in the frontend to save thumbnails specifically , also BTW , just checked and the thumbs/ folder is empty , so no wonder i am getting broken links. Hmmmmm ... So when exacly can i use the following function ? :D :D

Code: Select all

{{ thumbnail(record.image|image, 200, 200)  }}
??

Thank you.
Gautam.
Last edited by gautamz07 on Tue Nov 08, 2016 12:53 pm, edited 1 time in total.
User avatar
Celauran
Moderator
Posts: 6425
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: creating thumbnails in bolt .

Post by Celauran »

gautamz07 wrote:i don't see an option in the frontend to save thumbnails specifically
Like most things in Bolt, it's set in your config.yml file. Also, make sure your thumbs directory exists and your web server has write privileges.
gautamz07 wrote:

Code: Select all

{{ thumbnail(record.image|image, 200, 200)  }}
What is record? Does it have an image field? Do the records in question have images? Were they properly uploaded? Are they available full size? Any reason you're using both the thumbnail tag and the image filter?

https://docs.bolt.cm/3.2/templating/tem ... #imageinfo

You haven't specifically mentioned, but I assume you're using Bolt 3.2 since you're linking to it.
User avatar
gautamz07
Forum Contributor
Posts: 331
Joined: Wed May 14, 2014 12:18 pm

Re: creating thumbnails in bolt .

Post by gautamz07 »

@celauran ! , Thanks for the inputs , i'll look into all you've said and reply back here :) Thanks
Post Reply