File tree Expand file tree Collapse file tree
Plugin/Catalog/Block/Category Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,10 @@ public function __construct()
3131
3232 public function withDefaultImage (DefaultImage $ defaultImage )
3333 {
34- $ this ->defaultImage = trim ((string )$ defaultImage );
34+ $ defaultImageStr = trim ((string )$ defaultImage );
35+ if (!empty ($ defaultImageStr )) {
36+ $ this ->defaultImage = $ defaultImageStr ;
37+ }
3538 return $ this ;
3639 }
3740
@@ -102,7 +105,7 @@ public function build()
102105 'height ' => $ this ->dimensions ? $ this ->dimensions ->getHeight () : null ,
103106 'dpr ' => (string )$ this ->dpr ,
104107 'flags ' => $ this ->flags ,
105- 'default_image ' => $ this ->defaultImage ,
108+ 'default_image ' => $ this ->defaultImage ?? '' ,
106109 ]
107110 ];
108111 }
Original file line number Diff line number Diff line change 1010use Cloudinary \Configuration \Configuration ;
1111use Magento \Framework \View \Element \Block \ArgumentInterface ;
1212use Magento \Catalog \Model \Category ;
13+ use Cloudinary \Cloudinary \Core \Image as CoreImage ;
1314
1415class Image
1516{
@@ -58,12 +59,16 @@ public function afterGetUrl(
5859 $ filename = pathinfo ($ imagePath , PATHINFO_FILENAME );
5960 $ publicId = preg_replace ('/^cld_[a-f0-9]+_/ ' , '' , $ filename );
6061
61- return Media::fromParams ($ publicId , [
62+ $ asset = Media::fromParams ($ publicId , [
6263 'transformation ' => $ this ->transformation ->build (),
6364 'secure ' => true ,
6465 'sign_url ' => $ this ->configuration ->getUseSignedUrls (),
6566 'version ' => 1
66- ]);
67+ ]) . '?_i=AB ' ;
68+
69+ $ image = CoreImage::fromPath ($ asset , '' );
70+ return (string ) $ image ;
71+
6772 } catch (\Exception $ e ) {
6873 return $ result ; // fallback to original if Cloudinary fails
6974 }
You can’t perform that action at this time.
0 commit comments