singapore: the smallest big galery
home » forum » Mods » Album thumbnails w/ image titles.

You are not logged in.

  • Index
  •  » Mods
  •  » Album thumbnails w/ image titles.

#1 2007-01-15 16:03:46

forty two
Member

Album thumbnails w/ image titles.

So what I'm trying to do is take the image name that appears on the image.tpl.php page and have it appear in the thumbnail loop on the album.tpl.php page.

Code:

<?php for($index = $sg->gallery->startat; $index < $sg->gallery->imageCountSelected()+$sg->gallery->startat; $index++): ?>
  <?php echo $sg->gallery->images[$index]->thumbnailLink(); ?> 
  <?php echo $sg->image->name(); ?>
<?php endfor; ?>

I've tried a couple different versions of the last echo statement with a "Fatal Error: Call to a member function on a non-object in album.tpl.php on line 13."  Which is that last line of code.  Any ideas?

Cheers,
Derek

Last edited by forty two (2007-01-15 16:04:41)

Offline

 

#2 2007-01-15 20:09:27

pavian
Moderator

Re: Album thumbnails w/ image titles.

Offline

 

#3 2007-01-16 06:24:35

forty two
Member

Re: Album thumbnails w/ image titles.

Aha, thanks Pavian.  That was a great help.  I don't know why I didn't see that when I was poking around. smile
Cheers,
Derek

Offline

 

#4 2007-01-16 20:58:31

forty two
Member

Re: Album thumbnails w/ image titles.

Hey Pavian, a quick question.  There seems to be some layout errors occurring here.  you can check it out at http://test.ideacompany.ca/?page_id=164, um... don't mind some of the errors that show.  that's wp related and it's just a test site.  anyway, the code i'm using is from the post/topic above.  I've run through a couple different checks of it, but it seems to be wanting to put the text at the top of the thumbnail to it's right, instead of below the thumbnail it's supposed to be under.  here's the code it's currently set up with:

Code:

    <div class="sgAlbum">
        <?php for($index = $sg->gallery->startat; $index < $sg->gallery->imageCountSelected()+$sg->gallery->startat; $index++): ?>
              <?php echo '<div style="width : 100px; ">'; ?>
              <?php echo $sg->gallery->images[$index]->thumbnailLink(); ?>
            <?php echo $sg->gallery->images[$index]->name; ?>
            <?php echo "</div>"; ?>
        <?php endfor; ?>
        <div class="sgFoot"></div>
    </div>

Cheers,
Derek

Last edited by forty two (2007-01-16 20:59:05)

Offline

 

#5 2007-01-17 22:11:13

forty two
Member

Re: Album thumbnails w/ image titles.

So here it is all polished off.

Code:

    <div class="sgAlbum">
        <?php for($index = $sg->gallery->startat; $index < $sg->gallery->imageCountSelected()+$sg->gallery->startat; $index++): ?>
              <?php echo '<div class="sgAlbumSub">'; echo '<p class="sgAlbumImg">'; echo $sg->gallery->images[$index]->thumbnailLink(); echo '</p>'; ?>
            <?php echo '<p class="sgAlbumTitles">'; echo $sg->gallery->images[$index]->name; echo '</p>'; echo '</div>' ?>
        <?php endfor; ?>
        <div class="sgFoot"></div>
    </div>

and then in the css file you would need to add:

Code:

.sgAlbumSub {
    display: inline;
    float: left;
}

.sgAlbumImg {
}

.sgAlbumTitles {
    width: 134px;
    font-size: 9px;
    margin: 0px 24px 0px 24px;
    padding: -5px 0px 0px 10px;
    width: 100px;
}

make sure to adjust some of the css to your needs.

Offline

 

#6 2007-04-06 18:36:48

Dreth
Member

Re: Album thumbnails w/ image titles.

Forty two, could you tell me how to align it centered and under the thumbnail?  I can somehow accomplish it on Firefox but it ends up too far from the thumbnail it belongs to and too close to the one below, and on IE6 it doesn't even align to the bottom of the thumbnail.

Offline

 

#7 2007-12-04 03:14:15

samrohn
Member

Re: Album thumbnails w/ image titles.

im trying to accomplish the same thing in the NEAT2 template, but i'm kind of stuck, i added the above css (slightly modified) to neats main.css file, i have been trying to merge the above code with neat's album.tpl.php, & i ended up with this  -

Code:

<div class="sgAlbum"><table width="10%" cellspacing="5">
<?php for($index = $sg->gallery->startat; $index < $sg->gallery->imageCountSelected()+$sg->gallery->startat; $index++): ?>
<tr>
<?php for($j = $i; $j < $sg->config->thumb_cols_album + $i; $j++): ?>
<td>
<?php echo '<div class="sgAlbumSub">'; echo '<p class="sgAlbumImg">'; echo $sg->gallery->images[$index]->thumbnailLink(); echo '</p>'; ?>
<?php echo '<p class="sgAlbumTitles">'; echo $sg->gallery->images[$index]->name; echo '</p>'; echo '</div>' ?>
</td>
<?php endfor; ?>
</tr>
<?php endfor; ?>
</table><div class="sgFoot"></div>
</div>

however, it doesn't quite work right, every image (& title) is repeated on its own row, like

1-1-1
2-2-2
3-3-3

instead of

1-2-3
4-5-6
7-8-9

anyone with an idea how to get this to work correctly ?

thanks

Last edited by samrohn (2007-12-04 03:15:03)

Offline

 

#8 2007-12-04 04:19:35

DC
Administrator

Re: Album thumbnails w/ image titles.

Neat2 does not depend on css based layouts as the other templates do and the above code was intended for css based layouts. Becousee Neat2 uses a table based layout as its predecessor did, so it should work fine in any browser, where as true css based layouts can be a nightmare from browser to browser, some browsers can be very finicky with even the slightest of css code changes ...

That said what exactly are you trying to do?
Im not sure I understand you correctly ...

DC

Last edited by DC (2007-12-04 04:21:33)


To code or not to code that is the question?

Did my response help you out? Consider donating by buying me a slice, Whats this? Read More!
http://www.clickcraft.net/slice.php

Offline

 

#9 2007-12-04 05:05:11

samrohn
Member

Re: Album thumbnails w/ image titles.

sorry, im a little bleary from staring at code for the last few days, not really my main area of expertise -

yep, the css layouts were above my ability to modify properly, so im playing w/ neat2 (your version ?) for now...

currently, i'm trying to get neat2 to display image titles under the image thumbnails on album pages, as 42's code above does for modern, which i was able to get working -

on neat2, its almost working, but the album is repeating each image 3x on each row, as opposed to 3 different images per row, as one would expect - heres an (ugly, unfinished layout) sample page -

http://www.nylocations.com/test-x/%20%2 … t/Chicago/

thanks again dc -

sam

Last edited by samrohn (2007-12-09 06:06:32)

Offline

 

#10 2007-12-05 00:35:27

DC
Administrator

Re: Album thumbnails w/ image titles.

I see what your saying il try and look into this when I have a bit more time as its being used in a way I did not intend it to be used, il have to see if I can mod it for you just cant get to this right now, nice pics by the way ...

DC


To code or not to code that is the question?

Did my response help you out? Consider donating by buying me a slice, Whats this? Read More!
http://www.clickcraft.net/slice.php

Offline

 

#11 2007-12-09 06:04:38

samrohn
Member

Re: Album thumbnails w/ image titles.

thanks dc, i had to lay off it for a few days, i'm going to have another go at it now, thanks for the complements on the photos as well, this is more my field than php...

sam

Offline

 

#12 2007-12-16 02:31:29

DC
Administrator

Re: Album thumbnails w/ image titles.

Hi sam I modified the template a bit for your use, I also check for the length of the name so we dont blow our table.

I have sent you an email as to where you can get the mod template.

DC


To code or not to code that is the question?

Did my response help you out? Consider donating by buying me a slice, Whats this? Read More!
http://www.clickcraft.net/slice.php

Offline

 

#13 2008-01-21 08:18:10

crespowu
Member

Re: Album thumbnails w/ image titles.

Your conversation gave me a lot of information.Thanks a lot.


DVD to iPod

Last edited by crespowu (2008-02-18 08:24:51)

Offline

 
  • Index
  •  » Mods
  •  » Album thumbnails w/ image titles.