Skip to content

Commit 39fc9d9

Browse files
committed
add options to uploadFile
1 parent cc892d4 commit 39fc9d9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/MediaAlly.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ public function medially()
2727
/**
2828
* Attach Media Files to a Model
2929
*/
30-
public function attachMedia($file)
30+
public function attachMedia($file, $options = [])
3131
{
3232
if(! file_exists($file)) {
3333
throw new Exception('Please pass in a file that exists');
3434
}
3535

36-
$response = resolve(CloudinaryEngine::class)->uploadFile($file->getRealPath());
36+
$response = resolve(CloudinaryEngine::class)->uploadFile($file->getRealPath(), $options);
3737

3838
$media = new Media();
3939
$media->file_name = $response->getFileName();
@@ -47,9 +47,9 @@ public function attachMedia($file)
4747
/**
4848
* Attach Rwmote Media Files to a Model
4949
*/
50-
public function attachRemoteMedia($remoteFile)
50+
public function attachRemoteMedia($remoteFile, $options = [])
5151
{
52-
$response = resolve(CloudinaryEngine::class)->uploadFile($remoteFile);
52+
$response = resolve(CloudinaryEngine::class)->uploadFile($remoteFile, $options);
5353

5454
$media = new Media();
5555
$media->file_name = $response->getFileName();
@@ -106,19 +106,19 @@ public function fetchLastMedia()
106106
/**
107107
* Update the Media files relating to a particular Model record
108108
*/
109-
public function updateMedia($file)
109+
public function updateMedia($file, $options = [])
110110
{
111111
$this->detachMedia();
112-
$this->attachMedia($file);
112+
$this->attachMedia($file, $options);
113113
}
114114

115115
/**
116116
* Update the Media files relating to a particular Model record (Specificially existing remote files)
117117
*/
118-
public function updateRemoteMedia($file)
118+
public function updateRemoteMedia($file, $options = [])
119119
{
120120
$this->detachMedia();
121-
$this->attachRemoteMedia($file);
121+
$this->attachRemoteMedia($file, $options);
122122
}
123123

124124
}

0 commit comments

Comments
 (0)