Skip to content

Commit bbfc1dc

Browse files
Update changes
1 parent e912fcc commit bbfc1dc

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

config/cloudinary.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@
3838
* Upload Preset From Cloudinary Dashboard
3939
*
4040
*/
41-
'upload_preset' => env('CLOUDINARY_UPLOAD_PRESET')
41+
'upload_preset' => env('CLOUDINARY_UPLOAD_PRESET'),
42+
4243
];

resources/views/components/image.blade.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,29 @@
1515
use Cloudinary\Transformation\ImproveMode;
1616
use Illuminate\Support\Str;
1717
18+
1819
$retrieveFormattedImage = cloudinary()->getImageTag($publicId ?? '');
1920
21+
/**
22+
* SET ALT if provided
23+
*/
24+
if(isset($alt)) {
25+
$retrieveFormattedImage = cloudinary()->getImageTag($publicId ?? '')
26+
->setAttributes([
27+
'alt' => $alt ?? $publicId
28+
]);
29+
}
30+
31+
/**
32+
* SET CLASS if provided
33+
*/
34+
if(isset($class)) {
35+
$retrieveFormattedImage = cloudinary()->getImageTag($publicId ?? '')
36+
->setAttributes([
37+
'class' => $class
38+
]);
39+
}
40+
2041
/**
2142
* If the attribute is "crop"
2243
*/

src/CloudinaryServiceProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use CloudinaryLabs\CloudinaryLaravel\Commands\GenerateArchiveCommand;
1515
use CloudinaryLabs\CloudinaryLaravel\Commands\RenameFilesCommand;
1616
use CloudinaryLabs\CloudinaryLaravel\Commands\UploadFileCommand;
17+
use Illuminate\Support\Str;
1718

1819

1920
/**
@@ -105,7 +106,7 @@ protected function getComponentName($componentName)
105106
if( (int)$this->app->version()[0] <= 6 ) {
106107
$componentName = str_replace("-", "_", $componentName);
107108
}
108-
109+
109110
return $componentName;
110111
}
111112

0 commit comments

Comments
 (0)