We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34046
    • 14 Posts
    Ciao
    non sto riuscendo a ridimensionare le foto che ho nelle gallerie del Gallery, sono sempre tutte di dimensioni grandi e/o 'stretchate/allungate'.
    Utilizzo le seguenti cose:

    Risorsa Galleria usa Galleria template.
    Galleria Template ha una chiamata ad un chunk [[$galleriaRES]]

    snippet/Qgallery:

    <?php
    $gallery = $modx->getService('gallery','Gallery',$modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/').'model/gallery/',$scriptProperties);
    if (!($gallery instanceof Gallery)) return '';

    $c = $modx->newQuery('galAlbum');
    $c->where(array('name' => "Gallery"));
    $c->limit(1);
    $album= $modx->getObject('galAlbum',$c);

    if (!isset($album))
    return '';

    $albumArray = $album->toArray();

    $c = $modx->newQuery('galAlbumItem');
    $c->where(array('album' => $albumArray["id"]));
    $c->sortby('rank','ASC');

    $items= $modx->getCollection('galAlbumItem',$c);

    $cnt = 0;
    $images = "<ul class=\"albumContainer\">";
    foreach ($items as $item) {
    $modx->runSnippet("GalleryItem", array(
    "id" => $item->get("item"),
    "imageWidth" => 1000,
    "thumbWidth" => 200,
    "thumbHeight" => 100,
    "thumbZoomCrop" => 0,
    "toPlaceholdersPrefix" => "galitem"
    ));
    $images .= $modx->getChunk("GalleriaGalleriaItem");
    }
    $images .= "</ul>";
    return $images;


    chunk/GalleriaGalleriaItem:

    <li><a href="[[+galitem.image]]" title="[[+galitem.description]]"><img src="[[+galitem.thumbnail]]" width="200" height="100" alt="[[+galitem.name]]" title="[[+galitem.description]]"><span class="desc">[[+galitem.description]]</span></a></li>


    chunk/galleriaRES:

    [[!GalleryAlbums?
    &sort=`name`
    &dir=`ASC`
    &limit=`0`
    &toPlaceholder=`galleries`
    &parent=`14`
    &rowTpl=`galAlbumTpl`
    &prominentOnly=`0`
    &showAll=`0`
    &imageWidth=`1000`
    &thumbWidth=`225`
    &thumbHeight=`100`
    ]]
    [[!Gallery?
    &toPlaceholder=`gallery`
    &useCss=`0`
    &checkForRequestTagVar=`1`
    &imageWidth=`1000`
    &thumbWidth=`215`
    &thumbHeight=`110`
    ]]
    [[!GalleryItem?
    &imageWidth=`1000`
    &imageHeight=`700`
    ]]
    <ul class="albumContainer">
    [[+galleries]]
    </ul>
    <ul class="galleryContainer">
    [[!+galitem.image:notempty=`
    <li><a href="[[+galitem.image]]" title="[[+galitem.name]]" rel="colorbox"><img src="[[+galitem.image]]" alt="[[+galitem.name]]" title="[[+galitem.name]]"> <span class="nome">[[+galitem.description]]</span></a></li>
    `]]
    </ul>
    [[!+gallery:notempty=`
    <h2>[[+gallery.name]]</h2>
    <h3>[[+gallery.description]]</h3>
    <ul class="albumContainerBottom">
    [[+gallery]]
    </ul>
    `]]



    chunk/galAlbumTpl:

    <li><a href="[[~[[*id]]? &[[+albumRequestVar]]=`[[+id]]`]]#[[~[[*id]]]]"> [[+image:notempty=`<img src="[[+image]]" alt="[[+title]]" title="[[+title]]">`]]
    [[+showName:notempty=`<span>[[+name]]</span>`]]</a></li>



    chunk/galAlbumRowTpl:

    <li[[+cls:notempty=` class="[[+cls]]"`]]><a href="[[~[[*id]]? &[[+albumRequestVar]]=`[[+id]]`]]">[[+showName:notempty=`[[+name]]`]]</a></li>

    chunk/galItemThumb:

    <li class="[[+cls]]">
    <a href="[[+linkToImage:if=`[[+linkToImage]]`:is=`1`:then=`[[+image_absolute]]`:else=`[[~[[*id]]?
    &[[+imageGetParam]]=`[[+id]]`
    &[[+albumRequestVar]]=`[[+album]]`
    &[[+tagRequestVar]]=`[[+tag]]` ]]`]]" title="[[+name]]" [[+link_attributes]]>
    <img class="[[+imgCls]]" src="[[+thumbnail]]" alt="[[+name]]" [[+image_attributes]]>
    <span class="desc">[[+description]]</span>
    </a>
    </li>






      • 36888
      • 230 Posts
      Se non erro in Gallery ci sono i parametri da inserire nella chiamate per la dimensione delle thumb, altrimenti potresti usare phpthumof