Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/EloquentImageMutatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function getAttributeValue($key)
{
$value = $this->retrievePhotoFieldValue($key, $value);

if(!file_exists(public_path().$value->original->url) || empty($value->original->url)) {
if(empty($value->original->url)) {
$value = ImageService::getImageObject();
$this->attributes[$key] = $value->toJson();
}
Expand Down Expand Up @@ -106,6 +106,7 @@ public function retrievePhotoFieldValue($key, $value)
public function setImageAttributeForUploadedFileObject($key, $value)
{
$imageFieldObject = ImageService::uploadImage($key, $value);

$this->attributes[$key] = $imageFieldObject->toJson();
}

Expand Down
6 changes: 3 additions & 3 deletions src/config/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

return array(
'library' => 'gd',
'upload_dir' => 'uploads',
'assets_upload_path' => 'storage/app/uploads',
'upload_dir' => 'public/uploads',
'assets_upload_path' => 'public/uploads',
'quality' => 85,
'default' => [
'url' => 'http://placehold.it/150x150',
Expand All @@ -18,4 +18,4 @@
['640', '480', false, 85, 'medium'],
['800', '600', false, 85, 'large']
]
);
);
5 changes: 2 additions & 3 deletions src/dist/ImageFieldLocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ public function __construct($dimensions=[])
foreach ($dimensions as $key => $value) {
$this->{$value[4]} = new ImageFile();
}
$this->orignal = new ImageFile();
$this->original = new ImageFile();
return $this;
}

foreach ($dimensions as $key => $value) {

if($key == 'orignal'){
if($key == 'original'){

$this->$key = new ImageFile();
$this->$key->url = !empty($value['url']) ? $value['url'] : null;
Expand Down Expand Up @@ -61,4 +60,4 @@ public static function fromJson($jsonData=null)

return new self();
}
}
}
Loading