Link to resized image on album page

nameht

Joined: 2004-11-21
Posts: 46
Posted: Wed, 2010-08-04 05:54

Hello All,

I am working on trying to implement lightbox with G3.

I am very new to G3 and am trying to figure out how I would get the link to the image that shows up on the photo pages on the album page.

Any help would be great!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Wed, 2010-08-04 17:15

Edit album.html.php This will get you the URL for the resize image without any styling.

<?= $child->resize_img(array()) ?>

If you need/want to apply a css class to it:
<?= $child->resize_img(array("class" => "g-lightbox-resize")) ?>

Where g-lightbox-resize is your class name. Choose any name you want.

Also, probably best to be using a copy of a theme since if you edit Wind any upgrades to G3 will overwrite your changes:
http://codex.gallery2.org/Gallery3:Tutorials:Themes

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
nameht

Joined: 2004-11-21
Posts: 46
Posted: Wed, 2010-08-04 17:39

thanks this is getting close to what I need, but with the above code it outputs the URL but also an <img tag

eg.

Quote:
<img src="/var/resizes/Wedding/Family01.jpg?m=1280893563" alt="Family 01" width="700" height="525"/>

where as what I need it to out put would be

Quote:
<a href="/var/resizes/Wedding/Family01.jpg?m=1280893563" rel="lightbox[resize]">

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Wed, 2010-08-04 17:51

Ah, dug around a bit. Try (I didn't test this)

<?= $child->resize_url(true) ?>

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Wed, 2010-08-04 18:59

Just dinked around a bit more

That gives you the http://www.example.com/gallery3/var/resizes URL

This is without the domain name:
<? echo $child->resize_url(false); ?>

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
nameht

Joined: 2004-11-21
Posts: 46
Posted: Wed, 2010-08-04 20:46

works great thanks!!

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Thu, 2010-08-05 04:44

For the full size url:

<? echo $child->file_url(true); ?>

or
<? echo $child->file_url(); ?>

if you just need the relative path

And you may want to ultimately to check if the item is a photo or not:

<? if ($child->is_photo()): ?>
    <? echo $child->file_url(true); ?>
<? endif ?>

And if you're doing this on the photo page instead of the album page you'd change $child to $item

Also, if you get this done it would be great if you could share your changes with the community.

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
nameht

Joined: 2004-11-21
Posts: 46
Posted: Sat, 2010-08-07 20:48

This is what I ultimately ended up with, using the shadowbox module

<? if ($child->is_album()): ?>
    <a href="<?= $child->url() ?>">
      <?= $child->thumb_img(array("class" => "g-thumbnail")) ?>
<? else: ?>
   <a href="<?= $child->resize_url(true) ?>" rel="shadowbox[gallery]">
     <?= $child->thumb_img(array("class" => "g-thumbnail")) ?>
<? endif ?> 

thanks for all your help!