Forum

Thread tagged as: Problem, Gallery

Gallery app not adding resized image copies

On uploading new images, the admin images seem to load fine, but on the frontend of the site they do not load. It does not appear to be creating the additional resized copies.

short diagnostic report

Summary information

    Perch: 3.0.13, PHP: 5.5.9-1ubuntu4.22, MySQL: 5.5.58, with PDO
    Server OS: Linux, fpm-fcgi
    Installed apps: content (3.0.13), assets (3.0.13), categories (3.0.13), perch_forms (1.10), perch_gallery (2.8.9)
    App runtimes: <?php $apps_list = array( 'perch_forms', 'perch_gallery', );
    PERCH_LOGINPATH: /perch
    PERCH_PATH: /usr/share/nginx/sites/panther/perch
    PERCH_CORE: /usr/share/nginx/sites/panther/perch/core
    PERCH_RESFILEPATH: /usr/share/nginx/sites/panther/perch/resources
    Image manipulation: GD
    PHP limits: Max upload 40M, Max POST 40M, Memory: 128M, Total max file upload: 40M
    F1: 3b606135b33e6a102526838f4152a807
    Resource folder writeable: Yes
    SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
    REQUEST_URI: /perch/core/settings/diagnostics/
    DOCUMENT_ROOT: /usr/share/nginx/sites/panther
    HTTP_HOST: panther.furycodes.xyz

gallery.php

  <div class="prod">
    <?php perch_gallery_albums(array(
      'template' => 'album.html',
      'image' => true,
    )); ?>
  </div>

perch/templates/gallery/gallery.html

<perch:before>
  <perch:gallery id="description" type="textarea" textile="true" class="description"/>
  <ul>
</perch:before>
  <li>
    <p class="title"><perch:gallery id="imageAlt" /></p>
    <div class="slide-wrap">
      <img src="<perch:gallery id="main" />" alt="<perch:gallery id="imageAlt" />" class="small"/>
    </div>
    <img class="gal-img" src="<perch:gallery id="main" />" alt="<perch:gallery id="imageAlt" />" class="active"/>
  </li>
  <perch:after>
  </ul>
</perch:after>

perch/templates/gallery/image.html

<perch:gallery id="image" type="image" key="small" width="640" height="360" crop="true" />
<perch:gallery id="image" type="image" key="main"  width="1280" height="720" />
<perch:gallery id="image" type="image" key="thumb" width="160" height="160" density="2" crop="true" />

<perch:gallery id="desc" type="textarea" label="Description" size="s" markdown="true" editor="simplemde" />
Thomas Hunkapiller

Thomas Hunkapiller 0 points

  • 3 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hi Thomas,

It seems you're referencing the wrong template. In gallery.php, you're using 'template' => 'album.html' instead of gallery.html.

Here's the content of that file:

perch/templates/gallery/album.html

<perch:before>
  <ul>
</perch:before>
  <div class="prod-wrap">
    <div class="u-2-3">
      <a href="album.php?album=<perch:gallery id="albumSlug" />">
        <h3><perch:gallery id="albumTitle" /></h3>
      </a>
      <p>
        <perch:gallery id="description" type="textarea" textile="true" />
      </p>
      <a href="album.php?album=<perch:gallery id="albumSlug" />" class="button">View Gallery</a>
    </div>
    <div class="u-1-3">
      <a href="album.php?album=<perch:gallery id="albumSlug" />">
        <img src="<perch:gallery id="main" />" alt="<perch:gallery id="imageAlt" />" class="active"/>
      </a>
    </div>
  </div>
  <perch:after>
  </ul>
</perch:after>

and the html output for the image tag:

<img src="" alt="a1fa7721-a636-4e97-a847-39c98d0743be" class="active"/>

(the alt it's printing was part of the filename for the image that was generated by the camera)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you tried it with the default templates?

Yes, they don't work either.

For additional context, this was after upgrading from 2.x -> 3.x and moving to new server -- all the images uploaded before that work fine and still show up; new images do not.

So, previously I was using imagemagick as the backend. I commented out this line and it works now for new uploads.

//    define("PERCH_IMAGE_LIB", 'imagick');

Although I have imagemagick, imagemagick-core, and php5-imagick installed and enabled. IMO it should throw an error or detect a problem instead of just failing silently.