zenphoto forums » General Zenphoto Discussion

signature of getRandomImagesAlbum()

(21 posts)
  • Started 1 year ago by vincent3569
  • Latest reply from sbillard
  1. vincent3569

    Contributor
    Joined: Nov '08
    Posts: 660

    hi

    I have question : why did you change the signature of getRandomImagesAlbum() function on 1.4.2?

    With 1.4.1.6, the function signature was getRandomImagesAlbum ($rootAlbum = NULL, $daily = false, $showunpublished = false) and allows to display a random image, even if it is unpublished.

    With 1.4.2, the function signature is now getRandomImagesAlbum ($rootAlbum = NULL, $daily = false) and I can't display an unpublished image.

    this signature was useful: I was doing a random banner with pictures "hidden" in an unpublished album with unpublished images.

    for now, publish some picture is not enough : I need to publish the album too, and it is really not practical

    Posted 1 year ago #
  2. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,767

    I am sure that parameter was the victim of the changes needed to fix the function so that it would not show unpublished items in the "normal" case.

    I am not sure I understand the rationality of showing an unpublished image, though. Seems it kind of defeats the reasons for not publishing.

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  3. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,351

    I am not sure I understand the rationality of showing an unpublished image, though. Seems it kind of defeats the reasons for not publishing.
    I do understand. Sometimes you want to show some images somewhere that should not appear in the normal gallery (or in RSS!) like this example with the slideshow. We do similar with the logos under the "about" page which use the storage album that is used only for embedding images in articles. These do not appear in the rss feed therefore which would not make really sense as these images mean little without the article they are used in (of course we don't use the standard structure of a gallery anyway).

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  4. Zenphoto support team
    fretzl

    Moderator
    Joined: Sep '08
    Posts: 528

    Sometimes you want to show some images somewhere that should not appear in the normal gallery...
    Indeed. I think it's a very useful parameter.

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  5. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,767

    Randomly????

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  6. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,351

    Yes, why not, as you can select a specific (toplevel)album to pick from.

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  7. micheall

    Contributor
    Joined: Aug '09
    Posts: 513

    Could also be useful for situations like mine. For a time I had my header show a polaroid of random photos from the gallery. After a time I realized I only wanted to use certain highlight ones. To accomplish this I tagged them all with a "featured" tag then created a dynamic album.

    Is helpful to have something like that which pulls photos from all your gallery, but doesn't necessarily need to have itself published and double-up or mixup a certain structure or style of organization.

    Posted 1 year ago #
  8. easynow

    Member
    Joined: Feb '10
    Posts: 41

    Is this fixed yet? Is there a workaround? As the posters above, I used this function to call a randomimage from an unpublished album..

    Posted 9 months ago #
  9. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,351

    If you noticed there have been some releases in the last seven months..;-)

    Don't forget to read the Forum rules and usage resources
    Posted 9 months ago #
  10. easynow

    Member
    Joined: Feb '10
    Posts: 41

    sorry! I have just upgraded and I assumed this is why my old function doesnt work..

    Posted 9 months ago #
  11. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,351

    Well, we of course don't know about your function.

    Don't forget to read the Forum rules and usage resources
    Posted 9 months ago #
  12. easynow

    Member
    Joined: Feb '10
    Posts: 41

    Of course.

    So to be clear:


    getRandomImagesAlbum ($rootAlbum = NULL, $daily = false, $showunpublished = false)

    Is what I should be looking at? Or has this changed? I've rrecently upgraded by like 20 versions..

    Posted 9 months ago #
  13. easynow

    Member
    Joined: Feb '10
    Posts: 41

    It appears this string still doesn't have a showunpublished value..

    Posted 9 months ago #
  14. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,351

    Sorry, confused this as there was a ticket about the issue that this function showed unpublished stuff by itself which it should not do. That is fixed. Since there was never a ticket about this it probably got lost.

    Don't forget to read the Forum rules and usage resources
    Posted 9 months ago #
  15. easynow

    Member
    Joined: Feb '10
    Posts: 41

    So what do you recommend I do?

    Currently I use this:

    <?php printHeadingImage(getRandomImagesAlbum('header',false)); ?>

    But as you can see, I can only suggest the album and the 'daily' values. As the OP says, the option for 'showunpublished' is still omitted.

    This is the final tweak to my site!

    Posted 9 months ago #
  16. easynow

    Member
    Joined: Feb '10
    Posts: 41

    There IS a ticket, but it was disregarded:
    http://www.zenphoto.org/trac/ticket/2082

    This feature was removed because of the issues of showing not published images to unauthorized viewers. You can get it to show unpublished images if there is a logged on user with appropriated rights to view the album and image, so the workaround would be to temporarily set $_zp_loggedin so that the user has manageall rights when you call the function.

    The image is the main header of my site, so I doubt the workaround is of any use to me..

    Posted 9 months ago #
  17. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,351

    Well, if you need it now your only chance is to make your own custom function. If anything should be changed in that regard you should open a ticket but in any case it will not get in before 1.4.4 and that will be in quite a while.

    Don't forget to read the Forum rules and usage resources
    Posted 9 months ago #
  18. easynow

    Member
    Joined: Feb '10
    Posts: 41

    Ok. Fair enough. I still don't understand why this feature was removed, though.

    Posted 9 months ago #
  19. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,351

    I forgot about that ticket but I don't remember any of the circumstances anymore why that was not done.

    Don't forget to read the Forum rules and usage resources
    Posted 9 months ago #
  20. easynow

    Member
    Joined: Feb '10
    Posts: 41

    This feature was removed because of the issues of showing not published images to unauthorized viewers..

    :(

    Posted 9 months ago #
  21. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,767

    The image is the main header of my site, so I doubt the workaround is of any use to me..

    Just why do you think the workaround does not work for you? Have you even tried it?

    Don't forget to read the Forum rules and usage resources
    Posted 9 months ago #

RSS feed for this topic

Reply

You must log in to post.