Skip to content

Commit 4f4cb40

Browse files
authored
Release v0.5.0 (#53)
2 parents cfa15ba + 0c3623f commit 4f4cb40

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+607
-284
lines changed

README.md

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,33 +94,63 @@ class YourModel extends Model implements HasTransmorpherMediaInterface
9494
```
9595

9696
To configure your model to be able to have media and make API calls to the Transmorpher media server, you have to define specific array properties.
97-
Images and Videos are registered in those arrays by a media name.
97+
Images, Documents and Videos are registered in those arrays by a media name.
9898

9999
```php
100100
protected array $transmorpherImages = [
101101
'front',
102102
'back'
103103
];
104104

105+
protected array $transmorpherDocuments = [
106+
'user-guide',
107+
'warning-label'
108+
];
109+
105110
protected array $transmorpherVideos = [
106111
'teaser'
107112
];
108113
```
109114

110115
**NOTE:** These property names are not replaceable since they are expected by the `HasTransmorpherMedia` trait.
111116

117+
Additionally, you can define media by using methods. The function name will be used as media name.
118+
119+
```php
120+
public function side(): Image
121+
{
122+
return Image::for($this);
123+
}
124+
125+
public function privacyPolicy(): Document
126+
{
127+
return Document::for($this);
128+
}
129+
130+
public function trailer(): Video
131+
{
132+
return Video::for($this);
133+
}
134+
```
135+
112136
The trait `HasTransmorpherMedia` provides convenient methods to access your media.
113137

114138
```php
115139
// Retrieve all images as a collection, with media name as key and the Image object as value.
116140
$yourModel->images;
117141

142+
// Retrieve all documents as a collection, with media name as key and the Document object as value.
143+
$yourModel->documents;
144+
118145
// Retrieve all videos as a collection, with media name as key and the Video object as value.
119146
$yourModel->videos;
120147

121148
// Retrieve a single Image object.
122149
$yourModel->image('front');
123150

151+
// Retrieve a single Document object.
152+
$yourModel->document('user-guide');
153+
124154
// Retrieve a single Video object.
125155
$yourModel->video('teaser');
126156
```
@@ -213,7 +243,8 @@ To use the dropzone component in a template, you can simply include it like this
213243

214244
**_NOTE:_** You can optionally define a fixed width by setting the width attribute (e.g. `width="300px"`).
215245

216-
Depending on whether you pass a `Transmorpher\Image` or a `Transmorpher\Video`, the component will function as your upload form for images or videos.
246+
Depending on whether you pass a `Transmorpher\Image`, `Transmorpher\Document`
247+
or a `Transmorpher\Video` the component will function as your upload form for images, documents or videos.
217248

218249
#### Dynamic usage
219250

@@ -287,6 +318,9 @@ List of available transformations:
287318
- height
288319
- format
289320
- quality
321+
- page*
322+
323+
> Marked with * only applies to documents.
290324
291325
### Companion app
292326

@@ -324,8 +358,8 @@ App-specific GitHub Secrets:
324358

325359
#### Companion App
326360

327-
A demonstration app, which implements the client package, is booted with PullPreview and available at the PullPreview root URL. The Transmorpher media server runs
328-
under `/transmorpherServer`.
361+
A demonstration app, which implements the client package, is booted with PullPreview and available at the PullPreview root URL.
362+
The Transmorpher media server runs under the `transmorpher.` subdomain.
329363

330364
Additionally, an image is created with the branch name as tag. This image can be used in the Transmorpher media server for testing related changes. This image is deleted on pull
331365
request close.

amigor/app/Models/User.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ protected function casts(): array
5252
'back'
5353
];
5454

55+
protected array $transmorpherDocuments = [
56+
'document',
57+
'user-guide'
58+
];
59+
5560
protected array $transmorpherVideos = [
5661
'teaser',
5762
'full'

amigor/composer.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amigor/config/transmorpher.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@
5757
'mimetypes' => 'image/*',
5858
],
5959
],
60+
'document' => [
61+
'validations' => [
62+
// Max file size in mb.
63+
'max_file_size' => 100,
64+
'mimetypes' => 'application/pdf',
65+
],
66+
],
6067
'video' => [
6168
'validations' => [
6269
// Max file size in mb.
Lines changed: 29 additions & 0 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
2-
"/transmorpher.js": "/transmorpher.js?id=1583a86bf2270919b4e8e6750dfbdf5c",
3-
"/transmorpher.css": "/transmorpher.css?id=56dbb0cba726c3e63f1c109f6b9a6f1b",
2+
"/transmorpher.js": "/transmorpher.js?id=64e7f263794d4269ad64a9dccd40680c",
3+
"/transmorpher.css": "/transmorpher.css?id=e40c8169466f69329a2a26ae6e780513",
44
"/icons/delete.svg": "/icons/delete.svg?id=f88179ccc3649c47f2264315be6c0421",
5+
"/icons/document.svg": "/icons/document.svg?id=1b2d3210a6a3bb5e2c1ea933ae9dcc1a",
56
"/icons/enlargen.svg": "/icons/enlargen.svg?id=9f560ce3f022646dbb826a066715a343",
6-
"/icons/image.svg": "/icons/image.svg?id=4c114b26044e834f250b0ecc6ec62746",
7+
"/icons/image.svg": "/icons/image.svg?id=ed165947e72c93a532fa47f4fcb67881",
78
"/icons/more-info.svg": "/icons/more-info.svg?id=87d630fb3dacd138cf341a8bf75ad1f9",
89
"/icons/restore.svg": "/icons/restore.svg?id=86882b1085066cf01723a56cac85839e",
9-
"/icons/video.svg": "/icons/video.svg?id=33f552229edba3f4d1b9695254ce74c9"
10+
"/icons/video.svg": "/icons/video.svg?id=45df1043d580907eceefdb1959180677"
1011
}

amigor/public/vendor/transmorpher/transmorpher.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,16 @@
318318
.transmorpher .box-shadow-inset, .transmorpher .more-information-modal .card .card-body .card-side .media-preview, .transmorpher .version-list {
319319
box-shadow: inset 0 1px 1px 0 rgba(60, 75, 100, 0.14), inset 0 2px 1px -1px rgba(60, 75, 100, 0.12), inset 0 1px 3px 0 rgba(60, 75, 100, 0.2);
320320
}
321-
.transmorpher .video-transmorpher, .transmorpher .image-transmorpher {
321+
.transmorpher *[class*=-transmorpher] {
322322
display: flex;
323323
justify-content: center;
324324
height: 100%;
325325
position: relative;
326326
}
327-
.transmorpher .video-transmorpher img:first-of-type, .transmorpher .image-transmorpher img:first-of-type {
327+
.transmorpher *[class*=-transmorpher] img:first-of-type {
328328
height: 100%;
329329
}
330-
.transmorpher .dropzone.dz-clickable *:not(.video-transmorpher, .error-display, .error-display *, .dz-default, .dz-default *, .dz-preview, .dz.preview *), .transmorpher .full-size-link {
330+
.transmorpher .dropzone.dz-clickable *:not(.video-transmorpher, .error-display, .error-display *, .dz-default, .dz-default *, .dz-preview, .dz.preview *, .media-display), .transmorpher .full-size-link:not(.disabled) {
331331
cursor: zoom-in;
332332
}
333333
.transmorpher .full-size-link {
@@ -527,6 +527,10 @@
527527
top: 0;
528528
left: 0;
529529
}
530+
.transmorpher .media-display a.full-size-link.disabled {
531+
pointer-events: none;
532+
cursor: default;
533+
}
530534
.transmorpher .button, .transmorpher .version-list button {
531535
padding: 0.2rem 1rem;
532536
border: 0;

0 commit comments

Comments
 (0)