Reputation: 1280
I'm having trouble using Laravel-WebP (https://github.com/buglinjo/laravel-webp).
I did the installation as described on the page, as my laravel is version 5.8 disregarded the specific instructions for laravel less than or equal to 5.4.
Here is the fileupload debug
UploadedFile {#233 ▼
-test: false
-originalName: "B99700000_630509527083_main_17_Online_72DPI.jpg"
-mimeType: "image/jpeg"
-error: 0
#hashName: null
path: "C:\Users\esira\AppData\Local\Temp"
filename: "phpFABF.tmp"
basename: "phpFABF.tmp"
pathname: "C:\Users\esira\AppData\Local\Temp\phpFABF.tmp"
extension: "tmp"
realPath: "C:\Users\esira\AppData\Local\Temp\phpFABF.tmp"
aTime: 2019-03-06 18:16:36
mTime: 2019-03-06 18:16:36
cTime: 2019-03-06 18:16:36
inode: 0
size: 65310
perms: 0100666
owner: 0
group: 0
type: "file"
writable: true
readable: true
executable: false
file: true
dir: false
link: false
linkTarget: "C:\Users\esira\AppData\Local\Temp\phpFABF.tmp"
}
Here's my WebP code
WebP::make($request->arquivoEnviado->path())->save( storage_path('app/public/produtos/arquivo.webp'), 70 )
$request->arquivoEnviado->path() = Path of the temporary file.
dd($request->arquivoEnviado->path());
"C:\Users\esira\AppData\Local\Temp\php1FBB.tmp"
storage_path('app/public/produtos') = Destination folder.
When I debug the code "dd( WebP::make($request->arquivoEnviado->path())->save( storage_path('app/public/produtos'), 70 ) )" the return is true, but nothing appears in the folder.
Other information.
When I enter the filename in the destination path the debug returns false, if I put only the destination folder it returns true.
Certainly I'm not sure how to use WebP correctly, but unfortunately his documentation leaves nothing to be desired.
Upvotes: 0
Views: 3062
Reputation: 156
I was facing the same issue, I found that it's required to install cwebp
extension on the server and put the path in file laravel-webp.php
as shown as below.
'drivers' => [
'php-gd' => [],
'cwebp' => [
'path' => 'cwebp',
],
],
For reference: https://github.com/buglinjo/laravel-webp/issues/3
Upvotes: 4