is it possible to convert .webp image without shell_exec() or exec() in rosell-dk packages ? i am use rosell-dk package and install through composer. and rosell-dk package use shell_Exec() or exec() function .
Asked
Active
Viewed 961 times
1 Answers
0
Assuming you're talking about the rosell-dk/webp-convert package, it looks like the 'gd' converter uses the php-gd extension to convert from jpeg to webp without using any shell commands.
Based on the documentation you'd force the package to use the 'gd' converter like this:
<?php
// Initialise your autoloader (this example is using Composer)
require 'vendor/autoload.php';
use WebPConvert\WebPConvert;
$source = __DIR__ . '/logo.jpg';
$destination = __DIR__ . '/logo.jpg.webp';
$success = WebPConvert::convert($source, $destination, [
'converters' => ['gd']
]);

Michael Powers
- 1,970
- 1
- 7
- 12
-
using 'converters' => ['gd'] not working when i user 'converters' => ['cwebp'] then it works – ritesh javiya Oct 09 '18 at 12:21
-
The cwebp converter uses an external program to do the conversion and would use `shell_exec`. The gd converter doesn't, but requires that the php-gd extension be installed. Do you have the php-gd extension installed and enabled? – Michael Powers Oct 09 '18 at 12:23
-
yes gd is install . and its working fine but some large image are not converted. – ritesh javiya Oct 09 '18 at 12:33
-
You might be running into a memory limit if it's only large files. Do you get any errors? – Michael Powers Oct 09 '18 at 12:36
-
how can i set max upload time – ritesh javiya Oct 09 '18 at 13:01
-
Check out [max_execution_time](https://secure.php.net/manual/en/info.configuration.php#ini.max-execution-time) in php.ini. – Michael Powers Oct 09 '18 at 13:17