Is it posible to crop thumbnails to square shape?

I like this module very much but muy problem is that all thumbnails have diferent size because some are landscaped and other vertical. This is very ugly when I show all photos in a node.

Thanks.

CommentFileSizeAuthor
#2 errors.PNG21.01 KBcmedina

Comments

undersound3’s picture

Use http://drupal.org/project/imagecache_external/

In picasa-node-album-list.tpl.php you can then print out your thumbnail like:
<?php print theme('imagecache_external', array('path' => $image['image'], 'style_name'=> 'image_81x81')); ?>

Make sure you set permissions en white/black listing right for imagecache_external

cmedina’s picture

StatusFileSize
new21.01 KB

Thanks, but that does not work. I am not a programmer but I've done this:

This is the code before I changed:

...
<?php foreach($images as $image): ?>
    <a rel="lightbox[album]" href="<?php print $image['image']; ?>"><img src="<?php print $image['thumbnail']; ?>" hspace="2" /></a>
<?php endforeach; // end $'images foreach loop ?>
...

This is the code after modifying:

...
<?php foreach($images as $image): ?>
    <a rel="lightbox[album]" href="<?php print $image['image']; ?>"><img src="<?php print theme('imagecache_external', array('path' => $image['image'], 'style_name'=> 'foto_thumbnail')); ?>" hspace="2" /></a>
<?php endforeach; // end $'images foreach loop ?>
...

Where 'foto_thumbnail' is a new preset that I had created.

And this is the result:

" hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" /> " hspace="2" />

I have been discussing the problem and I do not know the reason ...

Attached log messages.

undersound3’s picture

The theme() function will print out the html for the img so just do:

    <?php foreach($album['images'] as $image): ?>
      <a rel="lightbox[album]" href="<?php print $image['image']; ?>">
        <?php print theme('imagecache_external', array('path' => $image['image'], 'style_name'=> 'thumbnail')); ?>
      </a>
    <?php endforeach; // end $album['images'] foreach loop ?>
cmedina’s picture

Thank you very much for the quick reply.

I've tried it and:

1) The first error was:

Warning: Invalid argument supplied for foreach() en include() (línea 23 de /home/u424460334/public_html/sites/all/modules/picasa_node_album/templates/picasa-node-album-detail.tpl.php).

2) Then, I changed <?php foreach($album['images'] as $image): ?> by <?php foreach($images as $image): ?> and the message disappeared.

3) But there are an others errors (a lot of them): the system tries to store in this directory system/files/styles/thumbnail/private/imagecache/externals/96d5f9d5c6b5fc87b94c933165bad641 which does not exist. I have a private files activated. So I think the problem is here.

What do you think?

undersound3’s picture

Yeah, you should use:
<?php foreach($album['images'] as $image): ?>
in picasa-node-album-list.tpl.php
and
<?php foreach($images as $image): ?>
in picasa-node-album-detail.tpl.php

Concerning #3, not sure but perhaps a permission issue. I did saw some issues with imagecache and private file system but dunno if that's still applicable. Perhaps a search can help you out on those topics.

cmedina’s picture

I've searched without success.

So thank you for your help and I am going to open a bug for the Imagecache External..

cmedina’s picture

Imagecache External doesn't work with private files activated.

Another idea to Crop thumbnails to square shape?

Is there any way to do that?

Thanks.