'err', 'message' => 'Duplicate id ' . $prog['id']]; $ids []= $prog['id']; if (!file_exists($prog['imgfront_path'])) return ['result'=>'err', 'message' => 'Image not found ' . $prog['title_short']]; if (!file_exists($prog['imgfull_path'])) return ['result'=>'err', 'message' => 'Image not found ' . $prog['title_short']]; foreach ($prog['extraimages_paths'] as $eipath) { if (!file_exists($eipath)) return ['result'=>'err', 'message' => 'Extra-Image not found ' . $prog['title_short']]; } } if ($warn != null) return $warn; return ['result'=>'ok', 'message' => '']; } public static function checkThumbnails() { foreach (self::listAll() as $book) { if (!file_exists($book['preview_path'])) return ['result'=>'err', 'message' => 'Preview not found ' . $book['title_short']]; } return ['result'=>'ok', 'message' => '']; } public static function createPreview($prog) { global $CONFIG; $src = $prog['imgfront_path']; $dst = $prog['preview_path']; if ($CONFIG['use_magick']) magick_resize_image($src, 200, 0, $dst); else smart_resize_image($src, 200, 0, true, $dst); } public static function getBook($id) { foreach (self::listAll() as $book) { if ($book['id'] == $id) return $book; } return null; } }