Hello my fellow Drupalers ;)
I recently figoured out how to display an image attached to the article (thanks to this topic: http://drupal.org/node/63114#comment-136051). Yet I'd love to have a function to scale the image down a bit without invoking too much unneeded stuff (in other words - I don't want to play around with image module ;) ). Would anyone be so kind to paste me a piece of code that would create attachments' thumbnails? Is it a lot of work? Maybe there already is such a function?
My simple piece of code looks like this:
if ($files){
print '<div class="aimg">';
foreach ($files as $file){
$ext = substr($file->description,-3);
$ext = strtoupper($ext);
if ($ext=='GIF' OR $ext=='JPG' OR $ext=='PNG'){
print '<img src="'.base_path().$file->filepath.'" alt="'.$file->description.'"/>';
}
print '</div>';
}
}
I just put it in node.tpl.php and it rocks until somebody bumps a 5 megapixel photo as node attachment ;))) any simple hack to make the upload module (?) scale the images wee bit? ;)
Thanks in advance :)
Comments
Some ideas are being
Some ideas are being discussed here http://drupal.org/node/25685
----------
Fernando Silva
Openquest - Sistemas de Informação, Lda
do it properly
use the imagecache module:
where yourimagecachepreset needs to be replaced with your imagecache preset
ps: i know this is way too late, but someone else might care...