![]() |
|
Display the First Album Image - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: Themes (https://forum.zenphoto.org/forum-5.html) +--- Thread: Display the First Album Image (/thread-882.html) Pages:
1
2
|
Display the First Album Image - bbish007 - 11-11-2006 On album.php I am looking to display the first image of the album as a preview to the album if possible. Basically to be able to display the current albums first image adjacent to the thumbnails. In fact any image would do from that album but ideally the first. Sorry, I am not a coder but would really appreciate the help Display the First Album Image - trisweb - 11-11-2006 Simple. Everything's always accessible. `` That should work. Stick it wherever you want that thumbnail. Display the First Album Image - bbish007 - 11-11-2006 That would display the thumbnail though. How would I display the actual image? Display the First Album Image - trisweb - 13-11-2006 Might have to be more complicated than that... go through the classes and $_zp_current_album (underlying Album class, available in your theme technically) to get what you need. Take a look at classes.php and the functions available there and you might find something :) Sorry I can't help more. Display the First Album Image - treatkor - 17-11-2006 this works for me: edit: unexpected results. sorry, i'm new to zenphoto Display the First Album Image - bbish007 - 19-11-2006 Hey no problem, thanks for looking. Anyone else have any ideas? Display the First Album Image - bbish007 - 19-11-2006 ` ` I'd expect it to be something along these lines though this returns the album name and not the filename. I will sort out the dimensions later. Display the First Album Image - bbish007 - 19-11-2006 I think all I need is a way on the album page to find what the current album ID is. The Display the First Album Image - trisweb - 20-11-2006 Oh [b]please[/b] just use the objects, they're fully featured! ` [img][/img]"> ` See how simple? This should work (barring any code mistakes, I haven't tested it or anything). This way you can change the size or whatever you like. If you want a custom sized image, use this line instead (replacing the $size, $width etc. with numbers or
It helps to know the classes inside-out of course ;-) I should write some good documentation, but the code is clean enough to read. Display the First Album Image - bbish007 - 28-11-2006 Thanks for the help and I agree the code is clean enough to read but I am well and truely punching above my weight with pretty much any PHP! (Note to self must get up to speed on PHP, JS, Ruby etc :-) ) I digress..... I am still having trouble with this though. I get the following error when trying to use the code, [quote] [/quote] ` $first_url = $image->getSizedImage(zp_conf('image_size')); ` I can't see what I am missing. I am using the 1.0.3 release. Display the First Album Image - trisweb - 29-11-2006 Try replacing the lines `$first_image = new Image($_zp_current_album, $images[0]); $first_url = $image->getSizedImage(zp_conf('image_size')); $first_desc = $image->getDesc();` with `$first_image = new Image($_zp_current_album, array_shift($images)); $first_url = $first_image->getSizedImage(zp_conf('image_size')); $first_desc = $first_image->getDesc();` Two problems: first, the array, I tested it this time, so it should be good. :-) So something you should learn from this are variables and variable names (the ones you use have to match the ones you define), and array indices. Those are pretty general programming ideas, not specific to PHP, so very useful concepts. Display the First Album Image - bbish007 - 29-11-2006 Tris, I really appreciate your help but I don't seem to be getting much closer. With the changes you have made, the output html is as follows with mod rewrite, ` [img]/~website path~/~album name~/image/595/[/img] ` Without mod rewrite, ` [img]/~website path~/zen/zen/i.php?a=test&i=&s=595[/img] ` This occurs regardless of what album I am in. (For clarity, I am runnning this on the album.php page) Thanks. Display the First Album Image - thinkdreams - 29-11-2006 bbish- note above a few comments, tris mentions the use of getcustomimage. that's probably what you want to use instead of getsizedimage, as getsizedimage will return the default image size from the zp-config file. getcustomimage will in turn show you a custom image size of your choosing (note the size, width, height params in that function). Does that help? That's why the 595 shows for the size parameter because if you are pulling from the unchanged (default) zp-config, the size is set to 595. Display the First Album Image - bbish007 - 29-11-2006 Thanks for looking ThinkDreams but unfortunately it does not help :-( I understand that the default parameter for the image size and this is returned from "zp_conf('image_size')". I have tried both techniques (custom image size and default) but with no success. I was simply trying to get the basic function to return the image name and description and then I would worry about the dimensions of the image returned. Small steps etc. As per the html I posted above, the problem is not with the default image size returned (that bit of the function works) but the fact it doesn't return the image name or any value for the description (alt text). e.g Display the First Album Image - trisweb - 29-11-2006 Yep, so let's recap: this is what we have for this: ` [img][/img]">` That should be correct. The URL's in your images above are also correct, I don't see anything wrong with them. Zenphoto's images are all passed through a script, they're never directly accessed -- thus, you'll get "/zen/i.php?a=album&i=image&w=400" from the code above, and that's how it's supposed to be. With mod_rewrite on, it's even cleaner, "/~album name~/image/595" is perfect, and should work. Is that image not showing? Let's clarify: What do you want to do exactly? Also, can we see your site? Thanks! Display the First Album Image - trisweb - 29-11-2006 So the image is displaying then? What else do you need? Has it occurred to you that the image might not have a description? Try adding one. Also, you can get the title using this: `` Try making the image tag like this:
Display the First Album Image - bbish007 - 29-11-2006 I am probably not explaining myself very well. To sum up, the image is not being displayed and neither is the description as the alt text ( I understand that not all my images have descriptions but some do and they should be displayed). @ Tris, can we forget about mod rewrite for the moment? From your reply above, no. 5230, you said, [i]"…..thus, you'll get '/zen/i.php?a=album&i=image&w=400' from the code above, and that's how it's supposed to be."[/i] Well I am not getting that (as per my earlier reply), it is not returning the html for the image part. e.g the "&i="part doesn't have the image name after it. Unless I am mistaken, how is the browser supposed to render the page and display the image if it isn't stated in the image tags?
Hopefully you understand my problem now. Display the First Album Image - trisweb - 30-11-2006 Oy, I forgot, old version... old notation... Replace:
With:
And when you upgrade to 1.0.4, out this week most likely, you'll have to go back to the first one ;-) Sorry for the confusion. Display the First Album Image - bbish007 - 30-11-2006 Whoot, nice one Tris. So glad I wasn't going mad ! :-) Display the First Album Image - dreado - 02-07-2007 I just tried this code, it does display the image but above it I get the following errors: Warning: Missing argument 4 for getcustomimage() in /x/x/x/x/zen/class-image.php on line 201 Warning: Missing argument 5 for getcustomimage() in /x/x/x/x/zen/class-image.php on line 201 Warning: Missing argument 6 for getcustomimage() in /x/x/x/x/zen/class-image.php on line 201 Warning: Missing argument 7 for getcustomimage() in /x/x/x/x/zen/class-image.php on line 201` |