Open bigappleinsider opened 8 years ago
The following does not work with minification:
<img alt="{{ $media->altText }}" src="@image($media, ['transformation' => $transformation], 'jpg')" />
I had to replace all image helpers:
<img alt="{{ $media->altText }}" src="{{ Abc\View\get_image_link($media, ['transformation' => $transformation], 'jpg') }}" />
We register image helper in app/lib/View/ViewServiceProvider.php as following:
app/lib/View/ViewServiceProvider.php
require 'helpers.php'; use Blade; use Cloudinary; use Config; use Illuminate\Support\ServiceProvider; class ViewServiceProvider extends ServiceProvider { protected $bladeExtensions = [ 'asset' => '$1<?= Abc\View\get_timestamped_asset_link$2 ?>', 'image' => '$1<?= Abc\View\get_image_link$2 ?>', ]; public function register() { Cloudinary::config( [ 'cloud_name' => Config::get('cloudinary.cloud') , 'cname' => 'images.abc.com' ] ); foreach ($this->bladeExtensions as $tagName => $interpolation) { Blade::extend(function ($view, $compiler) use ($tagName, $interpolation) { $pattern = $compiler->createMatcher($tagName); return preg_replace($pattern, $interpolation, $view); }); } } }
Can you suggest another solution?
The following does not work with minification:
<img alt="{{ $media->altText }}" src="@image($media, ['transformation' => $transformation], 'jpg')" />
I had to replace all image helpers:
<img alt="{{ $media->altText }}" src="{{ Abc\View\get_image_link($media, ['transformation' => $transformation], 'jpg') }}" />
We register image helper in
app/lib/View/ViewServiceProvider.php
as following:Can you suggest another solution?