Skip to content

Commit

Permalink
corp logic fix and enhancement (#28)
Browse files Browse the repository at this point in the history
* crop fix attempt 1

* crop fix attempt 2 with echo

* crop fix attempt 3

* crop fix attempt 4

* crop fix attempt 5 - with ceneter commands

* crop fix attempt 6 - with debug info

* crop fix attempt 7 - with debug info

* crop fix attempt 8

* crop fix attempt 9

* crop fix attempt 10

* crop fix cleanup

* added fill command and changed crop and rest of the refactor

* crop & fill: fixed missing h or w

* Update prod build npm

Co-authored-by: Ralph Schindler <[email protected]>
  • Loading branch information
ivanmarchenko83 and ralphschindler authored Apr 2, 2021
1 parent dac26ce commit 79706ba
Show file tree
Hide file tree
Showing 15 changed files with 14,199 additions and 1,443 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ composer.lock
.idea/
/node_modules
.phpunit.result.cache
Dockerfile
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ How long the browser should cache the image generated by this route for.
default value `env('IMAGERY_FORCE_UNMODIFIED_IMAGE_RENDERING', false)`

This will allow for the dynamic (controller) route or static route (link to storage, for example)
to be seletively used based on if modifiers are present in the image request
to be selectively used based on if modifiers are present in the image request

## Demo

Expand Down
4 changes: 2 additions & 2 deletions demo/app/SingleImageExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class SingleImageExample extends Model
'image' => [
'path' => 'single-image-examples/{id}.{extension}',
'presets' => [
'thumbnail' => 'fit_resize|size_50x50',
'timestampped' => 'v'
'thumbnail' => 'fit_resize|size_50x50|v',
'timestamped' => 'v' // ?
]
]
];
Expand Down
2 changes: 1 addition & 1 deletion demo/composer.json.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"require": {
"php": "^7.2.5",
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^6.3",
Expand Down
2 changes: 2 additions & 0 deletions demo/config/eloquent-imagery.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@
'quality',
'fit',
'grayscale',
'crop',
'fill'
]
]
],
Expand Down
24 changes: 21 additions & 3 deletions demo/database/seeds/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function run()
public function user()
{
DB::table('users')->insert([
'name' => 'Developer',
'email' => '[email protected]',
'name' => 'Developer',
'email' => '[email protected]',
'password' => bcrypt('password')
]);
}
Expand All @@ -44,6 +44,24 @@ public function singleImageExamples()
$model->save();
});

tap(new SingleImageExample, function ($model) {
$model->name = 'Croppable Image JPG Original 1600x1067';
$model->variations = [
'Crop 100x100, gravity south-west' => 'crop_100x100|gravity_south_west',
'Crop 300x300, gravity auto - means center' => 'crop_300x300|gravity_auto',
'Crop 300x300, gravity auto - means center by default' => 'crop_300x300',
// missing params example
'Fill 500x100, gravity auto' => 'fill|size_500x100',
'Fill 500x100, gravity north-west (west is ignored due to requested aspect ratio)' => 'fill|size_500x100|gravity_north_west',
'Fill 500x100, gravity north-east (north is ignored due to requested aspect ratio)' => 'fill|size_100x500|gravity_north_east',
// missing params example (for size)
'Fill 100x100, gravity auto' => 'fill|size_100x100',
'Fill 400x200, gravity auto' => 'fill|size_400x200',
];
$model->image->setData(file_get_contents(resource_path('example-images/multiple-people-1600x1067.jpg')));
$model->save();
});

tap(new SingleImageExample, function ($model) {
$model->name = 'Red Rectangle JPG Original 500x200';
$model->variations = [
Expand All @@ -63,7 +81,7 @@ public function singleImageExamples()
$model->variations = [
'no transformations' => '',
'Grayscale' => 'grayscale',
'Fit Scale Down to 200 pixels in width'=> 'fit_scale|size_200x',
'Fit Scale Down to 200 pixels in width' => 'fit_scale|size_200x',
'Fit Limit Pad Up to 800 pixels in width, extra space added has purple background' => 'fit_lpad|size_800x|bg_800080',
'Fit Resize to 300x100, will skew image' => 'fit_resize|size_300x100',
'Fit Limit to 600 in width, 300 in height - should not scale up' => 'fit_limit|size_600x300',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dist/js/nova.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/nova.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 79706ba

Please sign in to comment.