Page 1 of 1

creating thumbnails in bolt .

Posted: Tue Nov 08, 2016 12:51 am
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 ?

Re: creating thumbnails in bolt .

Posted: Tue Nov 08, 2016 7:18 am
by Celauran
What error messages are you getting? Are you saving thumbnails? Is the directory writable?

Re: creating thumbnails in bolt .

Posted: Tue Nov 08, 2016 12:43 pm
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.

Re: creating thumbnails in bolt .

Posted: Tue Nov 08, 2016 12:52 pm
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.

Re: creating thumbnails in bolt .

Posted: Tue Nov 08, 2016 1:27 pm
by gautamz07
@celauran ! , Thanks for the inputs , i'll look into all you've said and reply back here :) Thanks