buglinjo / laravel-webp Goto Github PK
View Code? Open in Web Editor NEWLaravel package for WebP image conversion
License: MIT License
Laravel package for WebP image conversion
License: MIT License
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Class 'App\Http\Controllers\Webp' not found
The issue occurred while working on Laravel 5.8 with php version 7.2
I'm using cwebp
as a default driver, /usr/local/bin/cwebp
as a path for cwebp.
And trying to convert my jpeg image to webp image using following code
$webp = Webp::make($file)->save($path);
Here, $webp
returns true but, I can't find moved image on the path $path
Hello. I'm having difficulties with this error
Class 'Laravel\Socialite\SocialiteServiceProvider' not found
How can I solve?
Hi, i want make owm output image name and upload own path. how can i use ?
$file = Input::file('image');
$webp = Webp::make(\request()->get('image'));
if ($file) {
$image_name = $slug . '-' . time() . '.' . $file->getClientOriginalExtension();
$image_webp_name = $slug . '-' . time() . '.' . 'webp';
$path = 'images/uploads/category/orginal';
$path_webp = 'images/uploads/category/webp';
$image_url = $path . '/' . $image_name;
$image_webp_url = $path_webp . '/' . $image_webp_name;
$file->move($path, $image_name);
$img = Image::make($image_url);
$img->resize(360, 360);
$img->save($image_url);
$webp->save(public_path($image_webp_url));
}
i use that format, orginal image work but webp image not uploaded my own path
thank you.
how to upload file with ext .webp ?
Hello,
When I try to save the webp file using command explicitly, it is working fine.
/home/Desktop/photography/libwebp-1.1.0-rc2-linux-x86-64/bin/cwebp -q 80 lijesh_shakya.jpg -o lijesh_shakya1.webp
Problem arose when I gave the same path for cwebp in config/laravel-webp.php
file like:
'drivers' => [
'cwebp' => [
'path' => '/home/Desktop/photography/libwebp-1.1.0-rc2-linux-x86-64/bin/cwebp',
],
],
And for saving code like:
Route::post('test.store', function(Request $request){
$webp = \Webp::make($request->file('name'));
if ($webp->save(storage_path('app/output.webp'))) {
dd("worked");
}else{
dd('not worked');
}
})->name('test.store');
It throws me an error like:
Buglinjo\LaravelWebp\CwebpShellExecutionFailed
Image conversion to WebP using cwebp failed with error code 126. This command was used to execute cwebp: /home/Desktop/photography/libwebp-1.1.0-rc2-linux-x86-64/bin/cwebp -q 80 /tmp/php3LZ0HJ -o /var/www/html/photography/storage/app/output.webp No output was sent to stdout
Hello,
When I try to save the webp file using command explicitly, it is working fine.
Problem arise when I gave the same path for cwebp in config/laravel-webp.php file like:
'drivers' => [
'cwebp' => [
'path' => 'C:/Users/dannyl/Downloads/libwebp-1.1.0-windows-x64 (2)/libwebp-1.1.0-windows-x64/bin/cwebp',
],
],
And for saving code like:
$path = "F:/test/property_images/";
$webp = Webp::make($request->file('profile_pic'));
if ($webp->save($path.'output.webp')) {
// File is saved successfully
echo "file saved sccuess";
}
laravel-webp/config/laravel-webp.php
Line 48 in c504443
Hello,
I am trying to save the file in my folder but when I upload it it gives me an error Drivers[] not supported. I am running this script in Laravel Lumen API. I am running the system in Windows 10 locally.
$webp = Webp::make($request->file); if ($webp->save(public_path($this->directory. '/'. $filenameWithoutExtension. '.webp'))) { echo 'test'; die; }
and I try with
$webp = Webp::make($request->file('file')); if ($webp->save(public_path($this->directory. '/'. $filenameWithoutExtension. '.webp'))) { echo 'test'; die; }
and i have the same problem "array_keys(): Argument #1 ($array) must be of type array, null given"
with funcion Webp::make
when I submit the form than show this error
its controller function
public function webp_image_store(Request $request){
$webp = Webp::make($request->file('images'));
if ($webp->save(public_path('webp_img))) {
// File is saved successfully
return back();
}
}
And its laravel-webp.php
'drivers' => [
'cwebp' => [
'path' => '/usr/local/bin/cwebp',
],
],
please tell me now which part change than I will get success result
Hello, i just install this package through composer, after vendor:publish i didn't see config file laravel-webp.php on config/laravel-webp.php, its normal and i can create it manualy? or i have to reinstall it? i'm using laravel 5.7.
Thanks
On windows and I get this error when running it.
Image conversion to WebP using cwebp failed with error code 1.
This command was used to execute cwebp:
C:\Program Files (x86)/libwebp-1.2.0-windows-x64/bin/cwebp -q 80 C:\wamp64\tmp\image 5585.jpg -o C:\ .... \boilerplate\storage\app/webp/image 5585.webp
No output was sent to stdout
It looks like it doesnt like the space in my file paths. If in Cwebp Class in the save function you change the line to the following add the quotes It allows for spaces.
$cmd = '"' . $this->cwebpPath . '" -q ' . $quality . ' "' . $this->image->getPathname() . '" -o "' . $outputPath . '"';
Any chance you can get this fixed up asap? or is there a work around for it?
I can do this in my config file but doesnt allow for spaces in file name so a fix for al would be good.
'drivers' => [
'php-gd' => [],
'cwebp' => [
'path' => '"C:\Program Files (x86)/libwebp-1.2.0-windows-x64/bin/cwebp.exe"',
],
],
Why i get response "failed to load response" if use laravel-webp?
When i comment the line,its work
Running \Webp::make($file)->save($path);
when using cwebp
results in printing:
Saving file '/var/www/html/storage/app/temp/test1.webp'
File: /tmp/phpdhNICn
Dimension: 50 x 50
Output: 64 bytes Y-U-V-All-PSNR 99.00 99.00 99.00 99.00 dB
(0.20 bpp)
block count: intra4: 0 (0.00%)
intra16: 16 (100.00%)
skipped: 15 (93.75%)
bytes used: header: 16 (25.0%)
mode-partition: 10 (15.6%)
Residuals bytes |segment 1|segment 2|segment 3|segment 4| total
macroblocks: | 6%| 0%| 0%| 94%| 16
quantizer: | 12 | 12 | 11 | 8 |
filter level: | 4 | 3 | 2 | 0 |
Please add -quiet
or consider using something that will capture the output (like Symfony's Process class).
Hi,
I've used this plugin to convert all images into webp. Project technology is laravel(php). Is there any way to show jpg image if browser don't support webp?
When I upload a photo in .png format, I encounter this error.
Can anyone help?
Hi. I noticed a minor bug in the Service Provider.
You had set a publish path grouped as laravel-assets
in provider file. I think that part should be removed.
Steps To Reproduce:
config/laravel-webp.php
filecomposer update
commandA declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.