javascriptjqueryhtmlcssgalleria

Galleria using full size images instead of thumbnails


When I inspect the element, it indicates galleria is using full size image instead of thumbnail.

Example from Galleria documentation is http://galleria.io/docs/getting_started/quick_start/

<div class="galleria">
    <a href="/img/large1.jpg"><img src="/img/thumb1.jpg" data-title="My title" data-description="My description"></a>
    <a href="/img/large2.jpg"><img src="/img/thumb2.jpg" data-title="Another title" data-description="My <em>HTML</em> description"></a>
</div>

My code is

<div class="galleria">
   <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/3D_Schildersdoek.JPG/812px-3D_Schildersdoek.JPG">
   <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/3D_Schildersdoek.JPG/220px-3D_Schildersdoek.JPG" alt=""/></a>
   <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Bitwa_pod_Grunwaldem_Muzeum_Narodowe_05.JPG/800px-Bitwa_pod_Grunwaldem_Muzeum_Narodowe_05.JPG">
   <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Bitwa_pod_Grunwaldem_Muzeum_Narodowe_05.JPG/300px-Bitwa_pod_Grunwaldem_Muzeum_Narodowe_05.JPG" alt=""/></a>
</div>

The link to jsfiddle for demo is http://jsfiddle.net/zain_aligent/EAVtM/4/

How can I make galleria use thumbnail images instead of full size images?


Solution

  • Key point is data-big attribute. Define gallery items like this.

    a href="ThumbImage.jpg" and img src="ThumbImage.jpg and data-big="LARGEIMAGE.jpg"

    <div class="galleria">
        <a href="ThumbImage.jpg">
            <img src="ThumbImage.jpg" 
                data-big="LargeImage.jpg" 
                data-title="My title" 
                data-description="My description"/>
        </a>
        <a href="ThumbImage.jpg">
            <img src="ThumbImage.jpg" 
                data-big="LargeImage.jpg" 
                data-title="My title" 
                data-description="My description"/>
        </a>
    </div>
    

    Try updated version below.

    <!DOCTYPE html>
    <html>
    
    <head>
        <link  type="text/css"  href="galleria/themes/classic/galleria.classic.css" media="screen" rel="stylesheet"  />
        <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
        <script src="galleria/galleria-1.3.6.min.js"></script>
    </head>
    
    <body>
    
    
    <div class="galleria">
        <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/3D_Schildersdoek.JPG/220px-3D_Schildersdoek.JPG">
            <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/3D_Schildersdoek.JPG/220px-3D_Schildersdoek.JPG" 
                data-big="http://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/3D_Schildersdoek.JPG/812px-3D_Schildersdoek.JPG" 
                data-title="My title" 
                data-description="My description"
                />
        </a>
        <a href="http://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Bitwa_pod_Grunwaldem_Muzeum_Narodowe_05.JPG/300px-Bitwa_pod_Grunwaldem_Muzeum_Narodowe_05.JPG">
            <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Bitwa_pod_Grunwaldem_Muzeum_Narodowe_05.JPG/300px-Bitwa_pod_Grunwaldem_Muzeum_Narodowe_05.JPG" 
                data-big="http://upload.wikimedia.org/wikipedia/commons/thumb/0/02/Bitwa_pod_Grunwaldem_Muzeum_Narodowe_05.JPG/800px-Bitwa_pod_Grunwaldem_Muzeum_Narodowe_05.JPG" 
                data-title="Another title" 
                data-description="My <em>HTML</em> description"
            />
        </a>
    </div>      
    
    
    
        <script type="text/javascript">
            $( document ).ready(function() {
                Galleria.loadTheme('galleria/themes/classic/galleria.classic.min.js');
    
                $('.galleria').galleria({
                width: 350,
                height: 315, 
                thumbCrop: "height",
                lightbox: true
                });
                Galleria.run('.galleria');
            });
        </script>
    
    </body>
    </html>