@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | protected function set_up_upload_folders() { |
| 34 | 34 | |
| 35 | 35 | if (!$this->is('image')) { |
| 36 | - $path = storage_path('app/' . $this->main_upload_folder . "/{$this->type}s/"); |
|
| 36 | + $path = storage_path('app/'.$this->main_upload_folder."/{$this->type}s/"); |
|
| 37 | 37 | File::isDirectory($path) or File::makeDirectory($path, 0777, true, true); |
| 38 | 38 | return null; |
| 39 | 39 | } |
| 40 | - $large_image_folder = storage_path('app/' . $this->full_path_lg); |
|
| 41 | - $medium_image_folder = storage_path('app/' . $this->full_path_md); |
|
| 42 | - $small_image_folder = storage_path('app/' . $this->full_path_sm); |
|
| 43 | - $extra_small_image_folder = storage_path('app/' . $this->full_path_xs); |
|
| 40 | + $large_image_folder = storage_path('app/'.$this->full_path_lg); |
|
| 41 | + $medium_image_folder = storage_path('app/'.$this->full_path_md); |
|
| 42 | + $small_image_folder = storage_path('app/'.$this->full_path_sm); |
|
| 43 | + $extra_small_image_folder = storage_path('app/'.$this->full_path_xs); |
|
| 44 | 44 | |
| 45 | 45 | File::isDirectory($large_image_folder) or File::makeDirectory($large_image_folder, 0777, true, true); |
| 46 | 46 | File::isDirectory($medium_image_folder) or File::makeDirectory($medium_image_folder, 0777, true, true); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | if ($this->id) { |
| 76 | 76 | return false; |
| 77 | 77 | } |
| 78 | - foreach($this->file_object_attributes as $attribute){ |
|
| 78 | + foreach ($this->file_object_attributes as $attribute) { |
|
| 79 | 79 | unset($this->$attribute); |
| 80 | 80 | } |
| 81 | 81 | unset($this->file_object); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | Image::make($this->file_object) |
| 102 | 102 | ->widen(config('media.LARGE_IMAGE_SIZE')) |
| 103 | 103 | ->save(storage_path('app/'.$this->full_path_lg.'/'.$stored_name)); |
| 104 | - } else { |
|
| 104 | + }else { |
|
| 105 | 105 | $this->file_object->storeAs($this->full_path_lg, $stored_name); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -129,30 +129,30 @@ discard block |
||
| 129 | 129 | return false; |
| 130 | 130 | } |
| 131 | 131 | if (!$this->is('image')) { |
| 132 | - Storage::delete($this->full_path . '/' . $this->stored_name); |
|
| 132 | + Storage::delete($this->full_path.'/'.$this->stored_name); |
|
| 133 | 133 | return true; |
| 134 | 134 | } |
| 135 | - Storage::delete($this->full_path_lg . '/' . $this->stored_name); |
|
| 136 | - Storage::delete($this->full_path_md . '/' . $this->stored_name); |
|
| 137 | - Storage::delete($this->full_path_sm . '/' . $this->stored_name); |
|
| 138 | - Storage::delete($this->full_path_xs . '/' . $this->stored_name); |
|
| 135 | + Storage::delete($this->full_path_lg.'/'.$this->stored_name); |
|
| 136 | + Storage::delete($this->full_path_md.'/'.$this->stored_name); |
|
| 137 | + Storage::delete($this->full_path_sm.'/'.$this->stored_name); |
|
| 138 | + Storage::delete($this->full_path_xs.'/'.$this->stored_name); |
|
| 139 | 139 | return true; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | public function url($image_size = 'lg') { |
| 143 | 143 | if ($this->is('image')) { |
| 144 | 144 | return Url::to(Storage::url($this->main_upload_folder."/images/{$image_size}/".$this->stored_name)); |
| 145 | - } else { |
|
| 145 | + }else { |
|
| 146 | 146 | return Url::to(Storage::url($this->main_upload_folder."/{$this->type}s/".$this->stored_name)); |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - public function get_image_info(array $sizes = ['lg','md','sm','xs']) |
|
| 150 | + public function get_image_info(array $sizes = ['lg', 'md', 'sm', 'xs']) |
|
| 151 | 151 | { |
| 152 | - if(!$this->is('image')){return null;} |
|
| 152 | + if (!$this->is('image')) {return null; } |
|
| 153 | 153 | |
| 154 | 154 | $info = []; |
| 155 | - foreach ($sizes as $size){ |
|
| 155 | + foreach ($sizes as $size) { |
|
| 156 | 156 | $info[$size] = [ |
| 157 | 157 | 'src' => url('/').$this->url($size), |
| 158 | 158 | 'width' => $this->width, |