Book Image

concrete5 Beginner's Guide

Book Image

concrete5 Beginner's Guide

Overview of this book

Table of Contents (19 chapters)
concrete5
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – restricting thumbnail dimension


You can make concrete5 restrict the maximum thumbnail dimensions by taking the following steps:

  1. concrete5 generates system thumbnails for every graphic file. There are two levels we can use by default: level 1 with a maximum dimension of 60 x 60 pixels and level 2 with a maximum dimension of 250 x 250 pixels.

  2. The file object returned by getAttribute has a method called getThumbnail which we can use to access the thumbnail. After the modification, the template should look like this:

    <?php 
    for ($i = 0; $i < count($cArray); $i++ ) {
        $cobj = $cArray[$i]; 
        $title = $cobj->getCollectionName(); ?>
    
    <h3 class="ccm-page-list-title"><a href="<?php echo $nh->getLinkToCollection($cobj)?>"><?php echo $title?></a></h3>
    <?php 
    $thumbnail = $cobj->getAttribute('thumbnail');
    if ($thumbnail) { 
        echo '<div class="ccm-page-list-thumbnail">'; 
        echo $thumbnail->getThumbnail(2); 
    ...