Obtain ALT for PageList Block Thumbnail
Permalink
Hi everybody,
I was wondering if there's a way to obtain alt attribute (Title, in File Manager) from a thumbnail image when you create a custom page list template, for SEO purposes.
What I´m looking for is something like this
Thanks in advance
I was wondering if there's a way to obtain alt attribute (Title, in File Manager) from a thumbnail image when you create a custom page list template, for SEO purposes.
What I´m looking for is something like this
<?php echo $thumb->alt ?>
Thanks in advance
Thanks, but I was looking how to extract the Title attribute from the file stored in File Manager.
Actually I just solved it, so here's my solution: I found the method getTitle, my problem was I was then I needed an object to use this method with
Using the code that page list provides I realized that $img is in fact an object so I can use the getTitle method.
I realized this looking at Image Helper functions page (http://www.concrete5.org/documentation/developers/files/helpers)
I´m not a developer and my PHP knowledge is pretty basic, so I´m not sure how clean is this, but it really works.
Actually I just solved it, so here's my solution: I found the method getTitle, my problem was I was then I needed an object to use this method with
Using the code that page list provides I realized that $img is in fact an object so I can use the getTitle method.
$img = $page->getAttribute('example_image_attribute_handle'); $thumb = $ih->getThumbnail($img, 64, 9999, false); $thumbTitle = $img->getTitle();
I realized this looking at Image Helper functions page (http://www.concrete5.org/documentation/developers/files/helpers)
I´m not a developer and my PHP knowledge is pretty basic, so I´m not sure how clean is this, but it really works.
$f might not be the right file object, depending on your template
http://www.weblicating.com/cheat-sheet/...