| @@ 80-95 (lines=16) @@ | ||
| 77 | * Get poster URI like /upload/gallery/1/orig/9ds2jd1.png |
|
| 78 | * @return null|string |
|
| 79 | */ |
|
| 80 | public function getPosterUri() |
|
| 81 | { |
|
| 82 | $pName = $this->poster; |
|
| 83 | // check if poster is defined |
|
| 84 | if ($pName === null || Str::likeEmpty($pName)) { |
|
| 85 | return null; |
|
| 86 | } |
|
| 87 | ||
| 88 | // build path and check is file exists on disk |
|
| 89 | $path = '/upload/gallery/' . $this->id . '/orig/' . $pName; |
|
| 90 | if (!File::exist($path)) { |
|
| 91 | return null; |
|
| 92 | } |
|
| 93 | ||
| 94 | return $path; |
|
| 95 | } |
|
| 96 | ||
| 97 | /** |
|
| 98 | * Get poster thumbnail uri |
|
| @@ 101-117 (lines=17) @@ | ||
| 98 | * Get poster thumbnail uri |
|
| 99 | * @return null|string |
|
| 100 | */ |
|
| 101 | public function getPosterThumbUri() |
|
| 102 | { |
|
| 103 | $pName = $this->poster; |
|
| 104 | if ($pName === null || Str::likeEmpty($pName)) { |
|
| 105 | return null; |
|
| 106 | } |
|
| 107 | ||
| 108 | // remove extension, thumbs always in jpeg ;D |
|
| 109 | $pName = Str::cleanExtension($pName); |
|
| 110 | $path = '/upload/gallery/' . $this->id . '/thumb/' . $pName . '.jpg'; |
|
| 111 | ||
| 112 | if (!File::exist($path)) { |
|
| 113 | return null; |
|
| 114 | } |
|
| 115 | ||
| 116 | return $path; |
|
| 117 | } |
|
| 118 | } |
|