Jump to content

Recommended Posts

Posted

Hello

I am trying to figure out how I can do this particular thing... when I upload a bunch of Image in a page I would like to make the first Images as a big thumbnail and rest in smaller thumbnails... I could not figure how I can manipulate each image separately.. hope I make sense.. 

Teja

Posted

Scaling should happen on later time, on template level I think. (Don't mess up the originals)

code for your template:

$images = $page->images; // assumed that the field called images

if(count($images)) {
    foreach($images as $image) {
        $width = $image === $images->first ? 600 : 200;
        $thumb = $image->width($width);
        echo "<img src='{$thumb->url}' alt='{$thumb->description}' />";
    }
}

This should work, didn't test it.

  • Like 5
Posted

Created two Images fields one for large thumbnail and another for list of smaller thumnails...

and did this code... works for me... moved around the code....

                        <?php
                        echo "";
                        $items = $pages->get('/artwork/recent-work/')->children("limit=6"); // Here we take children of portfolio page (limit=6)
                            foreach($items as $item) { //Loop through them
                            $image = $item->images->first();
                            $thumb = $image->size(267,186);
                            echo"<div class='grey_text'>{$item->title}</div>";
                            echo "<div class='gallery_thumbs'><a href='{$image->url}' rel='imagezoom(group1)'><img class='gallery_item' src='{$thumb->url}' alt='{$thumb->description}'></a></div>";
                            if ($item->thumbnail_images) {
                                // randomize some images
                                $image2 = $item->thumbnail_images->getRandom(150);
                                foreach($image2 as $images2) {
                                    $thumbnail = $images2->size(201,147);
                                    $larger = $images2->size(800,600);
                                    echo "<a href='{$larger->url}' rel='imagezoom' ><img class='photo' src='{$thumbnail->url}' alt='{$image->description}' /></a>";
                                }
                            }
                            echo "<div class='inside_left_right'>{$item->body}</div>";
                            echo"<div class='clear'></div>";
                        }
                        echo ""; ?>

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...