Xpn Posted February 10, 2014 Share Posted February 10, 2014 Hi There, Is it possible to get the child image path? Now it only output the image file name but not the path to the image it self. Thanks, Xpn <div id="portfolio-content" class="sort fourcol"> <?php foreach($page->children as $child) echo " <div class=''> <div class='port-item-container'> <div class='port-box'> <div class='zoom-holder'> <img src='{$child->overviewimg}'> <a href='{$child->overviewimgbig}' class='fancybox' title='Title'> <div class='zoom'> <div class='zoom-inner'></div> </div> </a> </div> </div> <div class='port-item-title'> <h6><a rel='bookmark' title='{$child->title}' href='{$child->url}'>{$child->title}</a></h6> <span>{$child->overviewtxt} <a href='{$child->url}'> More info. »</a></span> </div> </div> </div> "; ?></div> Link to comment Share on other sites More sharing options...
adrian Posted February 10, 2014 Share Posted February 10, 2014 Hi Xpn and welcome to Processwire. Accessing the url for the image is as easy as: $child->overviewimg->url The only caveat to that is how your overviewimg field is set up. If the Max Files Allowed setting (Details tab) is set to anything but 1, you will need to use one of the following; $child->overviewimg->first()->url $child->overviewimg->last()->url $child->overviewimg->eq(x)->url //where x is the number of the image in the array of images, starting with 0 as the first. Also, have a read of: http://processwire.com/api/fieldtypes/images/ Link to comment Share on other sites More sharing options...
Xpn Posted February 10, 2014 Author Share Posted February 10, 2014 Thanks Adrian, I'm going to try out right now Cheers, Xpn Wow... that simple, Thanks! Link to comment Share on other sites More sharing options...
adrian Posted February 10, 2014 Share Posted February 10, 2014 Things in PW generally are simple Also, in case you haven't seen it yet, you need to read through the cheatsheet: http://cheatsheet.processwire.com/ Link to comment Share on other sites More sharing options...
Xpn Posted February 10, 2014 Author Share Posted February 10, 2014 I really like the way Processwire is working... comming from MODx, getting to complex. Will look through the cheatsheet Thanks! Link to comment Share on other sites More sharing options...
kongondo Posted February 10, 2014 Share Posted February 10, 2014 Welcome Xpn (cool name, btw!)...since you mentioned the "m" word, this thread might be of interest in case u missed it.. Link to comment Share on other sites More sharing options...
Xpn Posted February 11, 2014 Author Share Posted February 11, 2014 Thanks for the link Kongonda! Link to comment Share on other sites More sharing options...
Xpn Posted February 11, 2014 Author Share Posted February 11, 2014 Just installed the Thumbnails Module anybody familiar with the module? I would like the use the thumb instead of the normal image . Can this code some how be used to get the child image thumb path? $page->cropImages->eq(0)->getThumb('thumbnail'); Something like: {$child->overviewimgbig->cropImages->eq(0)->getThumb('thumbnail')->url} Thanks, Xpn Link to comment Share on other sites More sharing options...
adrian Posted February 11, 2014 Share Posted February 11, 2014 Make sure you read the instructions for the module: "getThumb returns url to the thumbnail you have asked for" So all you would need would be: $child->overviewimgbig->eq(0)->getThumb('thumbnail') There is also a great video on the usage of the module here: http://processwire.com/videos/using-the-image-thumbnail-plugin/ Link to comment Share on other sites More sharing options...
Xpn Posted February 11, 2014 Author Share Posted February 11, 2014 I tried that and also: $child->overviewimgbig->eq(0)->getThumb('thumbnail')->url But it give Error: Call to a member function eq() on a non-object I watched the video very nice and easy way to get a portfolio up and running Link to comment Share on other sites More sharing options...
Xpn Posted February 11, 2014 Author Share Posted February 11, 2014 Got it... getting late here Thanks for all the help! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now