Member
Member
Stephane   2007-02-16, 01:03
#1

Building upon the success of my previous request, I was wondering if anyone would want to help me out with my next issue.

I'm trying to build my image.php such that clicking the image will send you to the next image and so on, until the last image that would in theory send you back to the first. A simple cycle.

I'm thinking it would be useful in this case to have a function call the first image of the album, and get the URL from that. If there's a simpler way, let me know!

Developer
Developer
trisweb   2007-02-16, 03:39
#2

I'd skip an abstraction layer for that and go straight for the class--

$firstimage = $_zp_current_album->getImage(0);
does exactly what you want :-)

Member
Member
Stephane   2007-02-16, 05:08
#3

It works! Fantastic!

Member
Member
lenaluna   2007-10-19, 14:08
#4

i have found the code to click on the image to go the next image. now I would like to implement above as well, so the last will get you back to the first image. but I have no idea where to put the bit of '$firstimage' code...

Member
Member
ruiner   2011-02-01, 13:02
#5

How can I get link by id, if the desired image not in current album? The class above isn't working of course.

Administrator
Administrator
acrylian   2011-02-01, 13:45
#6

Zenphoto almost never works with the id. It always uses the "name" of an item. To do this you have to setup the album object of the album yourself. See the object model tutorial.

Member
Member
ruiner   2011-02-02, 01:16
#7

I don't want to use the filename, because it's a variable (I can change it anytime), and the id is persistent through the lifetime of image in gallery. I'm trying to make links on images within images (like hotspots).

How can i get any image full link using id?

Member
Member
sbillard   2011-02-02, 01:31
#8

Be very careful how you change the filename, else you may also change the ID if Zenphoto thinks it is a new image.

Anyway, there is no way to create a link which uses the ID as the linked object. Zenphoto works only with album/image names.

If you just want to find an image by id you can always use a SQL SELECT query.

Member
Member
ruiner   2011-02-02, 01:55
#9

Thank you, I'll try.

Member
Member
ruiner   2011-02-02, 07:57
#10

I've ended with the following:

`

function getImageLinkbyID($id) {

$image = query_single_row("SELECT `albumid,filename FROM " . prefix('images') . " WHERE id=" . $id);
$album = query_single_row("SELECT folder FROM " . prefix('albums') . " WHERE id=" . $image['albumid']);

$url = html_encode(getGalleryIndexURL(false)) . "?album=" . $album['folder'] . "%26image=" . $image['filename'];

return($url);
}

Administrator
Administrator
acrylian   2011-02-02, 10:29
#11

More elegant would be to use the object model. Regarding names. Don't confuse the title with the name of an item!

Member
Member
ruiner   2011-02-06, 01:11
#12

I have found a problem.

On Mobile Safari (on my ipod touch, or on regular Safari with ipod user-agent) link containing url-encoded '&' symbol (%26) shows following error:

Zenphoto Error: the requested object was not found.
Album: okhotsk_seashore/coastâ„‘=nuklya_cape_sunset.jpg

Is it zenphoto or mobile safari bug?

Member
Member
sbillard   2011-02-06, 03:26
#13

The ampersand really should be encoded & not %26.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.