ImageRepository.php 625 B

1234567891011121314151617
  1. <?php
  2. class ImageRepository extends BaseRepository implements IImageRepository {
  3. public static function GetImagesByAlbum($albumId) {
  4. $images=array();
  5. $prep=self::$PDO->prepare("SELECT image_id FROM images WHERE album_id=? AND image_deleted=0");
  6. $prep->execute(array($albumId));
  7. while ($imageId=$prep->fetchColumn())
  8. $images[]=new Image($imageId);
  9. return $images;
  10. }
  11. public static function DeleteImages($imageIds) {
  12. $inQuery = implode(',', array_fill(0, count($imageIds), '?'));
  13. $prep=self::$PDO->prepare("UPDATE images SET image_deleted=1 WHERE image_id IN ($inQuery)");
  14. $prep->execute($imageIds);
  15. }
  16. }