PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Nov 20, 2017 2:40 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Nov 08, 2016 1:51 am 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
I currently have the following lines of code in my index.twig file to output the image of a post:

Syntax: [ Download ] [ Hide ]
<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:

Syntax: [ Download ] [ Hide ]
thumbnail(filename, w, h)


https://docs.bolt.cm/3.2/cheatsheet#bolt-functions-in-twig

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

Syntax: [ Download ] [ Hide ]
<img src="{{ thumbnail(record.image|image, 200, 200)  }}" alt="">


But i get a broken link instead. why is this happening ?


Top
 Profile  
 
PostPosted: Tue Nov 08, 2016 8:18 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6391
Location: Montreal, Canada
What error messages are you getting? Are you saving thumbnails? Is the directory writable?

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Tue Nov 08, 2016 1:43 pm 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
I just get broken links , like so:

http://imgur.com/a/awU2m

Quote:
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

Syntax: [ Download ] [ Hide ]
{{ thumbnail(record.image|image, 200, 200)  }}
??

Thank you.
Gautam.


Last edited by gautamz07 on Tue Nov 08, 2016 1:53 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue Nov 08, 2016 1:52 pm 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6391
Location: Montreal, Canada
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:
Syntax: [ Download ] [ Hide ]
{{ 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.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Tue Nov 08, 2016 2:27 pm 
Offline
Forum Contributor
User avatar

Joined: Wed May 14, 2014 12:18 pm
Posts: 331
@celauran ! , Thanks for the inputs , i'll look into all you've said and reply back here :) Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group