Skip to content

Commit 27f594c

Browse files
committed
Speed improvements
1 parent c0dda31 commit 27f594c

File tree

1 file changed

+15
-23
lines changed

1 file changed

+15
-23
lines changed

src/LfmItem.php

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,25 @@
44

55
use Illuminate\Support\Str;
66
use Symfony\Component\HttpFoundation\File\UploadedFile;
7-
use Intervention\Image\Facades\Image;
87

98
class LfmItem
109
{
1110
private $lfm;
1211
private $helper;
1312

14-
private $columns = ['name', 'file_name', 'url', 'size', 'time', 'dimensions', 'icon', 'is_file', 'is_image', 'thumb_url'];
13+
private $columns = [
14+
'name',
15+
'file_name',
16+
'url',
17+
'size',
18+
'time',
19+
'dimensions',
20+
'icon',
21+
'is_file',
22+
'is_image',
23+
'thumb_url',
24+
];
25+
1526
public $attributes = [];
1627

1728
public function __construct(LfmPath $lfm, Lfm $helper)
@@ -143,32 +154,13 @@ public function time()
143154
public function dimensions()
144155
{
145156
if ($this->isImage() && !$this->isSvg()) {
146-
return $this->width() . 'x' . $this->height();
157+
list($width, $height) = getimagesize($this->path());
158+
return $width . 'x' . $height;
147159
}
148160

149161
return false;
150162
}
151163

152-
/**
153-
* Get width of the image
154-
*
155-
* @return bool|int
156-
*/
157-
public function width()
158-
{
159-
return $this->isImage() && !$this->isSvg() ? Image::make($this->path())->width() : false;
160-
}
161-
162-
/**
163-
* Get height of the image
164-
*
165-
* @return bool|int
166-
*/
167-
public function height()
168-
{
169-
return $this->isImage() && !$this->isSvg() ? Image::make($this->path())->height() : false;
170-
}
171-
172164
public function thumbUrl()
173165
{
174166
if ($this->isDirectory()) {

0 commit comments

Comments
 (0)