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