If I want to display only certain photos?

Hello again,

Ok, here's what I'm after: I'm letting users upload images and Zenphoto is showing them fine. But I want to be able to review them before the images are seen in the gallery. I added a new field "status" to the images table, which is 0 at default. When I approve the image, I set the "status" to 1. And what I want is to display only images that have "status" set to 1.

The only SELECT query for the database which I found was in the classes.php using the entry variable. I tried to add my check here but it didn't work. If someone could tell me how I can manage to pull this off, I would be really greateful.

Comments

  • trisweb Administrator
    The proper (abstracted) way to do this is to add a new class variable to the Image class, call it status or something, then populate it from the database field in the Image constructor. Do this in `function Image($image, $album)` around line 31 in classes.php. Your 'status' field should already be in `$entry['status'];` after the query, and if there is an $entry (so, in the else branch).

    After that, just add a check to the Album->getImages() method ...

    `foreach ($files as $file) {

    $image = new Image($this, $file);

    if ($image->status != 0) {

    $images[] = new Image($this, $file);

    }

    }`

    Bingo. That should do it.
  • Mania Member
    Holy shit, it works! Besides the above, I had to add a check to the getAlbumThumb() function not to display a thumb in the album cover if the image doesn't have a status of 1.

    Ah, I'm so happy (for a while), thanks a million!
  • trisweb Administrator
    No problem, glad to help :)
Sign In or Register to comment.