company logo exception fixed..
This commit is contained in:
@ -3,10 +3,12 @@
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use App\Models\Common\Media;
|
||||
use Illuminate\View\View;
|
||||
use File;
|
||||
use Image;
|
||||
use Storage;
|
||||
use Illuminate\View\View;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Intervention\Image\Exception\NotReadableException;
|
||||
|
||||
class Logo
|
||||
{
|
||||
@ -32,12 +34,26 @@ class Logo
|
||||
$path = base_path('public/img/company.png');
|
||||
}
|
||||
|
||||
$image = Image::cache(function($image) use ($path) {
|
||||
$width = setting('invoice.logo_size_width');
|
||||
$height = setting('invoice.logo_size_height');
|
||||
try {
|
||||
$image = Image::cache(function($image) use ($path) {
|
||||
$width = setting('invoice.logo_size_width');
|
||||
$height = setting('invoice.logo_size_height');
|
||||
|
||||
$image->make($path)->resize($width, $height)->encode();
|
||||
});
|
||||
$image->make($path)->resize($width, $height)->encode();
|
||||
});
|
||||
} catch (NotReadableException | \Exception $e) {
|
||||
Log::info('Company ID: ' . session('company_id') . ' viewcomposer/logo.php exception.');
|
||||
Log::info($e->getMessage());
|
||||
|
||||
$path = base_path('public/img/company.png');
|
||||
|
||||
$image = Image::cache(function($image) use ($path) {
|
||||
$width = setting('invoice.logo_size_width');
|
||||
$height = setting('invoice.logo_size_height');
|
||||
|
||||
$image->make($path)->resize($width, $height)->encode();
|
||||
});
|
||||
}
|
||||
|
||||
if (empty($image)) {
|
||||
return $logo;
|
||||
|
Reference in New Issue
Block a user