signature of getRandomImagesAlbum()

vincent3569 Member, Translator
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

Comments

  • 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.
  • acrylian Administrator, Developer
    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).
  • fretzl Administrator, Developer
    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.
  • Randomly????
  • acrylian Administrator, Developer
    Yes, why not, as you can select a specific (toplevel)album to pick from.
  • 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.
  • Is this fixed yet? Is there a workaround? As the posters above, I used this function to call a randomimage from an unpublished album..
  • acrylian Administrator, Developer
    If you noticed there have been some releases in the last seven months..;-)
  • sorry! I have just upgraded and I assumed this is why my old function doesnt work..
  • acrylian Administrator, Developer
    Well, we of course don't know about your function.
  • 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..
  • It appears this string still doesn't have a showunpublished value..
  • acrylian Administrator, Developer
    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.
  • 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!
  • 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..
  • acrylian Administrator, Developer
    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.
  • Ok. Fair enough. I still don't understand why this feature was removed, though.
  • acrylian Administrator, Developer
    I forgot about that ticket but I don't remember any of the circumstances anymore why that was not done.
  • This feature was removed because of the issues of showing not published images to unauthorized viewers..
    :(
  • 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?
Sign In or Register to comment.