Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary problem #1

Open
sarpaykent opened this issue Jul 16, 2015 · 1 comment
Open

Binary problem #1

sarpaykent opened this issue Jul 16, 2015 · 1 comment

Comments

@sarpaykent
Copy link

I have error like this

Fatal error: Uncaught exception 'Exception' with message 'Unable to locate binary file' in C:\work\htdocs\pbot\vendor\bensquire\php-image-optim\src\PHPImageOptim\Tools\Common.php:26 Stack trace: #0 C:\work\htdocs\pbot\vendor\lciolecki\php-image-optimizer\src\Extlib\ImageOptimizer.php(75): PHPImageOptim\Tools\Common->setBinaryPath('/usr/bin/jpegop...') #1 C:\work\htdocs\pbot\test.php(9): Extlib\ImageOptimizer->__construct(Array) #2 {main} thrown in C:\work\htdocs\pbot\vendor\bensquire\php-image-optim\src\PHPImageOptim\Tools\Common.php on line 26

my code

<?php

require_once("vendor/autoload.php");

$optimizer = new \Extlib\ImageOptimizer(array(
    \Extlib\ImageOptimizer::OPTIMIZER_OPTIPNG => '/usr/bin/optipng',  //your_path
    \Extlib\ImageOptimizer::OPTIMIZER_JPEGOPTIM => '/usr/bin/jpegoptim', //your_path
    \Extlib\ImageOptimizer::OPTIMIZER_GIFSICLE => '/usr/bin/gifsicle' //your_path
));

$optimizer->optimize("image.png"); //return true
$optimizer->optimize("image.jpg"); //return true
$optimizer->optimize("image.gif"); //return true
$optimizer->optimize("file.txt"); //return false
@lciolecki
Copy link
Owner

I see that you use Windows.. I don't test this case and I don't know whether there are exists solutions optipng/jpgeoptim/gifsicle for Windows.. You can try install some of this app for windwows and set for example:

$optimizer = new \Extlib\ImageOptimizer(array(
\Extlib\ImageOptimizer::OPTIMIZER_OPTIPNG => 'C:\optipng\optipng.exe'
));

But really I don't know whether this would be works..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants