By tregismoreira on
Hello Staff,
I am stating change the view that the Image Gallery (image of the module) is standard. The next part of the code that makes the current view:
if (!empty($images)) {
$content .= '<ul class="images">';
foreach ($images as $image) {
$content .= theme('image_gallery_img', $image, $size);
}
$content .= "</ul>\n";
}
function theme_image_gallery_img($image, $size) {
$width = $size['width'];
// We'll add height to keep thumbnails lined up.
$height = $size['height'] + 75;
$content = '<li';
if ($image->sticky) {
$content .= ' class="sticky"';
}
$content .= " style='height : {$height}px; width : {$width}px;'>\n";
$content .= l(image_display($image, IMAGE_THUMBNAIL), 'node/'. $image->nid, array(), NULL, NULL, FALSE, TRUE);
$content .= '<h3>'. l($image->title, 'node/'. $image->nid) .'</h3>';
if (variable_get('image_gallery_node_info', 0)) {
$content .= '<div class="author">'. t('Posted by: !name', array('!name' => theme('username', $image))) ."</div>\n";
if ($image->created > 0) {
$content .= '<div class="date">'. format_date($image->created) ."</div>\n";
}
}
$content .= "</li>\n";
return $content;
}
The result of that code looks like this:
<ul class="images">
<li style='height : 150px; width : 100px;'>
<a href="/gallery/?q=node/4"><img src="http://localhost/gallery/files/images/Dia-dos-pais-2008-008.thumbnail.jpg" alt="Peixinho e Cavalinho 2" title="Peixinho e Cavalinho 2" class="image image-thumbnail " width="100" height="75" /></a>
<h3><a href="/frog-gallery/?q=node/4">Peixinho e Cavalinho 2</a></h3></li>
<li style='height : 150px; width : 100px;'>
</ul>I need that the display is also this:
<div id="gallery">
<a href="images/1.jpg">
<img src="images/1_thumb.jpg" />
</a>
</div>
I tried to use the Content Template but forgot it only serves to Contant Types. Do you have any idea how can I change this?
Thank you again.
Thiago Régis
Comments
Override theme function
hi,
you can change the behavior by overriding theme function.
for that copy above theme_image_gallery_img($image, $size) function and put in your
template.php then replace this function with your theme name
eg. themename_image_gallery_img($image, $size) then write logic here.
my problem is I do not
my problem is I do not understand much programming. Does someone have an idea of how I start to write this function?
Thank you again.
Its right on front of
Heres a short primer on doing a phptemplate callback (different method) http://drupal.org/node/11811
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.