Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit 11046dd

Browse files
committed
Use render method instead and update docs for render image endpoint
1 parent e6c770d commit 11046dd

File tree

5 files changed

+124
-124
lines changed

5 files changed

+124
-124
lines changed

app/Transformers/Assets/AssetTransformer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public function transform(Asset $model)
2222
'path' => $model->path,
2323
'mime' => $model->mime,
2424
'links' => [
25-
'full' => url('api/assets/'.$model->uuid),
26-
'thumb' => url('api/assets/'.$model->uuid.'?width=200&height=200'),
25+
'full' => url('api/assets/'.$model->uuid.'/render'),
26+
'thumb' => url('api/assets/'.$model->uuid.'/render?width=200&height=200'),
2727
],
2828
'created_at' => $model->created_at->toIso8601String(),
2929
];

docs/api/blueprint/dataStructures/assets.apib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
+ type: `image` (string) - The asset type
55
+ path: `12342bh3y3bn3i4i5ii5b43o3n.jpg` (string) - The asset path in the storage
66
+ links
7-
+ full: `https://laravelapi.test/api/assets/0c244c51-0a3b-4b86-829a-ee161c2f966f` (string) - The asset link for render full size
8-
+ thumb: `https://laravelapi.test/api/assets/0c244c51-0a3b-4b86-829a-ee161c2f966f?width=200&height=200` (string) - The asset link for render thumb size
7+
+ full: `https://laravelapi.test/api/assets/0c244c51-0a3b-4b86-829a-ee161c2f966f/render` (string) - The asset link for render full size
8+
+ thumb: `https://laravelapi.test/api/assets/0c244c51-0a3b-4b86-829a-ee161c2f966f/render?width=200&height=200` (string) - The asset link for render thumb size
99
+ created_at : `1997-07-16T19:20:30+01:00` (string) - Date in format iso 8601
1010

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
99
"prod": "npm run production",
1010
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
11-
"docs": "aglio -i docs/api/blueprint/apidocs.apib --theme-variables Flatly -o resources/views/apidocs.blade.php"
11+
"docs": "aglio -i docs/api/blueprint/apidocs.apib --theme-variables Flatly --theme-template triple -o resources/views/apidocs.blade.php"
1212
},
1313
"devDependencies": {
1414
"axios": "^0.15.3",

resources/views/apidocs.blade.php

Lines changed: 118 additions & 118 deletions
Large diffs are not rendered by default.

routes/api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
$api->get('ping', 'Api\PingController@index');
1010

11-
$api->get('assets/{uuid}/{width?}/{height?}', 'Api\Assets\RenderFileController@show');
11+
$api->get('assets/{uuid}/render', 'Api\Assets\RenderFileController@show');
1212

1313
$api->group(['middleware' => ['auth:api'], ], function ($api) {
1414

0 commit comments

Comments
 (0)