Skip to content

Commit

Permalink
Merge pull request #32 from ctessier/1.0
Browse files Browse the repository at this point in the history
Release v1.0.2
  • Loading branch information
ctessier authored Mar 15, 2020
2 parents 64b92fc + d7bc055 commit 0644e10
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 4 deletions.
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Release Notes

## [v1.0.2](https://github.com/ctessier/nova-advanced-image-field/compare/v1.0.1...v1.0.2)

> Released 2020/03/15
### Added

- This very CHANGELOG file

### Fixed

- Fix use of `->path()` to specify a custom subdirectory ([#29](https://github.com/ctessier/nova-advanced-image-field/pull/29)). Thanks [mathd](https://github.com/mathd)!

## [v1.0.1](https://github.com/ctessier/nova-advanced-image-field/compare/v1.0.0...v1.0.1)

> Released 2019/02/26
### Added

- Improve localization ([#17](https://github.com/ctessier/nova-advanced-image-field/pull/17)). Thanks [mziraki](https://github.com/mziraki)!

## [v1.0.0](https://github.com/ctessier/nova-advanced-image-field/compare/v0.2.0...v1.0.0)

> Released 2019/02/15
### Changed

- Use of `previewUrl` instead of `thumbnailUrl` in the Detail and Form component ([#12](https://github.com/ctessier/nova-advanced-image-field/pull/12)).

## [v0.2.0](https://github.com/ctessier/nova-advanced-image-field/compare/v0.1.1...v0.2.0)

> Released 2019/02/15
### Fixed

- Fix 409 Conflict when deleting the file ([#5](https://github.com/ctessier/nova-advanced-image-field/pull/5)).

## [v0.1.1](https://github.com/ctessier/nova-advanced-image-field/compare/v0.1.0...v0.1.1)

> Released 2018/11/30
### Added

- Add S3 filesystem upload support ([#1](https://github.com/ctessier/nova-advanced-image-field/pull/1)).
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

This package provides an advanced image field for Nova resources allowing you to upload, crop and resize any image.

It uses [Cropper.js](https://fengyuanchen.github.io/cropperjs) with [vue-cropperjs](https://github.com/Agontuk/vue-cropperjs) in the frontend and GD/Imagick and [Intervention Image](http://image.intervention.io) in the backend.
It uses [Cropper.js](https://fengyuanchen.github.io/cropperjs) with [vue-cropperjs](https://github.com/Agontuk/vue-cropperjs) in the frontend and GD and [Intervention Image](http://image.intervention.io) in the backend.

![screenshot of the advanced image field](https://github.com/ctessier/nova-advanced-image-field/blob/1.0/screenshot.png?raw=true)

Expand All @@ -15,7 +15,6 @@ It uses [Cropper.js](https://fengyuanchen.github.io/cropperjs) with [vue-cropper
- Laravel & Nova
- Fileinfo Extension
- GD Library (>=2.0)
- Imagick PHP extension (>=6.5.7)

## Installation

Expand All @@ -27,7 +26,7 @@ composer require ctessier/nova-advanced-image-field

## Usage

`AdvancedImage` extends from `File` so you can use any methods that `File` implements. See the documentation [here](https://nova.laravel.com/docs/1.0/resources/file-fields.html).
`AdvancedImage` extends from `File` so you can use any methods that `File` implements. See the documentation [here](https://nova.laravel.com/docs/2.0/resources/fields.html#file-field).

```php
<?php
Expand Down Expand Up @@ -66,6 +65,9 @@ class Post extends Resource

// Store to AWS S3
AdvancedImage::make('photo')->disk('s3'),

// Specify a custom subdirectory
AdvancedImage::make('photo')->disk('s3')->path('image'),
];
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/AdvancedImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ protected function fillAttribute(NovaRequest $request, $requestAttribute, $model
}

$image->stream();
$fileName = $request->{$this->attribute}->hashName();
if ($this->storagePath === '/') {
$fileName = $request->{$this->attribute}->hashName();
} else {
$fileName = trim($this->storagePath, '/').'/'.$request->{$this->attribute}->hashName();
}
Storage::disk($this->disk)->put($fileName, $image->__toString());
$image->destroy();

Expand Down

0 comments on commit 0644e10

Please sign in to comment.