Great snippet, thanks. Is it possible to get hold of the image name without the extension in a template chunk? It would be nice to be able to use that as the alt text.
Quote from: simonalexander2005 at Nov 18, 2013, 12:02 PMGreat snippet, thanks. Is it possible to get hold of the image name without the extension in a template chunk? It would be nice to be able to use that as the alt text.
Sure. [[+imgName]] should get that for you if it is a .jpg otherwise you will have to edit the snippit for the type image you are using. I will try to rewrite it so that it works with any file extension when I get a chance but right now I am in the middle of some major work to make my sites "Mobil First"
[[!getImages? &getImages_Folder=`assets/images/produsentlogo/produsentlogo` &getImages_Ext =`jpg,gif,png,JPG,GIF,PNG` &getImages_Image_Tpl =`getImages_producerLogo` &getImages_Page_Tpl =`getImages_Page_Tpl` &getImages_Width =`150` &getImages_Heigth=`100` &getImages_Border=`2` &getImages_Class =`imgClass` &getImages_PageClass =`section` &getImages_InfoClass =`info` &getImages_ExifClass =`exif` &getImages_Id =`imgId` &getImages_PageId =`section` &getImages_InfoId =`info` &getImages_ExifId =`exif` &getImages_Paging =`0` &limit =`6` &pageLimit=`3` ]]
<img src="[[+imgLink:phpthumbof=`w=96&h=96`]]" class="img-thumbnail" alt="[[+imgFile]"/>
[[!getPage? &elementClass=`modSnippet` &element=`getImages` &getImages_Folder=`assets/images/produsentlogo` &getImages_Ext =`jpeg,jpg,gif,png,JPEG,JPG,GIF,PNG` &getImages_Image_Tpl =`getImages_producerLogo` &getImages_Page_Tpl =`getImages_producerLogo_Page` &getImages_Class =`img-thumbnail` &getImages_PageClass =`list-thumb list-inline` &getImages_InfoClass =`info` &getImages_ExifClass =`exif` &getImages_Id =`imgId` &getImages_PageId =`ul` &getImages_InfoId =`info` &getImages_ExifId =`exif` &getImages_Paging =`0` &limit =`6` &pageLimit=`3` ]]
<li><img src="[[+imgLink:phpthumbof=`w=64&h=64`]]" class="[[+class]]" alt="[[+imgName]]"/></li>
<ul class="[[+pageClass]]">[[+photos]]</ul>
[[!getImages? &getImages_Folder=`assets/images/expositions/expo` &getImages_Paging =`0` &getImages_Ext =`*.jpg,*.png` ]]
/***** SET VARIABLES *****/ $folder = isset($_GET['folder']) ? $_GET['folder'] : ''; // use to get folder from URL // $folder = $modx->getOption('getImages_Folder', $scriptProperties, 'assets/photos'); // use to get default folder, or from parameters
You need to comment out line2 (by adding // at the beginning), and remove the // from the beginning of line 3 to uncomment it.
Since you're sending the folder value as a property, it won't be in the $_GET array, so you need to get it from the $scriptProperties array with $modx->getOption().