yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.23k stars 6.91k forks source link

Upgrade Imagine to solve problem on Windows 7 #7458

Closed tecnologiaterabyte closed 8 years ago

tecnologiaterabyte commented 9 years ago

Hi, I have a strange problem with yii2-imagined just gives error ERR_CONNECTION_RESET, I tried it and it is not the library imagick () is the extension.

My Config: imagick install correct support all formats.

imagick

My Code-Yii2-Imagine: (Not Works Windows 7 Ultimate N X64 Error: ERR_CONNECTION_RESET)

<?php
    use yii\imagine\Image;
    Yii::setAlias('@images', dirname(dirname(__DIR__)) . '/frontend/web/imagenes/usuarios/profile');
    Image::thumbnail('@webroot/perfil_google.jpg', 100, 100)
    ->save(\yii::getAlias('@images/thumb-test-photo-1.jpg'), ['quality' => 80]);
?>

My Code-Imagick(): (Work Perfect)

<?php 
    Yii::setAlias('@images', dirname(dirname(__DIR__)) . '/frontend/web/imagenes/usuarios/profile');
    $im = new Imagick();
    $im->readImage(\yii::getAlias('@webroot/perfil_google.jpg'));
    $im->thumbnailImage(100, 100);
    $im->writeImage(\yii::getAlias('@images/thumb-test-photo.jpg'));
    $im->destroy();
 ?>

Server Config:

1.- Apache 2.4.12-x64. download: http://www.apachelounge.com/download/. 2.- PHP 5.6.6 x64-ts-VC11. download: http://www.apachelounge.com/download/. 3.- Imagick ImageMagick-6.9.0-7-Q16-x64-dll. download: http://www.imagemagick.org/script/binary-releases.php#windows 4.- OS: Windows 7 Ultimate N X64.

samdark commented 9 years ago

Anything in logs?

tecnologiaterabyte commented 9 years ago

/backend/runtime/logs/app:

2015-02-25 07:03:51 [192.168.1.101][3][-][error][Imagine\Exception\RuntimeException] 
samdark commented 9 years ago

And that's it? Is there a trace or mention of what this RuntimeException is?

tecnologiaterabyte commented 9 years ago

No mention anything, I have the tracelevel => 3

Change mesagges a trace:

2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\Application::bootstrap] Bootstrap with dektrium\user\Bootstrap::bootstrap() 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\Module::getModule] Loading module: user 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\Module::getModule] Loading module: debug 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\Application::bootstrap] Bootstrap with yii\debug\Module::bootstrap() 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\Module::getModule] Loading module: gii 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\Application::bootstrap] Bootstrap with yii\gii\Module::bootstrap() 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\web\UrlManager::parseRequest] No matching URL rules. Using default URL parsing logic. 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\web\Application::handleRequest] Route requested: '' 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\Controller::runAction] Route to run: site/index 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\InlineAction::runWithParams] Running action: backend\controllers\SiteController::actionIndex() 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\views\site\index.php in C:\webs\intracheck\backend\controllers\SiteController.php:60 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts\main.php in C:\webs\intracheck\backend\controllers\SiteController.php:60 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\rbac\DbManager::checkAccessRecursive] Checking role: Administrador in C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts\main.php:42 in C:\webs\intracheck\backend\controllers\SiteController.php:60 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts_menuser.php in C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts\main.php:57 in C:\webs\intracheck\backend\controllers\SiteController.php:60 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts_sidebar.php in C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts\main.php:77 in C:\webs\intracheck\backend\controllers\SiteController.php:60 2015-02-25 19:56:17 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts_footer.php in C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts\main.php:101 in C:\webs\intracheck\backend\controllers\SiteController.php:60 2015-02-25 19:56:17 [192.168.1.101][3][-][info][application] $_COOKIE = [ 'BACKENDSESSID' => 'm1hfv2emgg2q68pk152306vgl5' '_backendCSRF' => '2f001c066e118c4a9796a7db6a30ce6261af3eff53aba02ff712abbd27119171a:2:{i:0;s:12:\"_backendCSRF\";i:1;s:32:\"wfTNQ9DeHYn4Vhd07w3WxpavZBjwquCi\";}' ]

$_SESSION = [ 'flash' => [] 'returnUrl' => '/admin' '__id' => 3 'user.username' => 'admin' 'user.name' => 'WILMER ANDRES ARAMBULA' 'user.register' => 1415058504 'user.avatar30' => '//www.intracheck.tk/frontend/web/imagenes/usuarios/profile/30/j8bjr4.gif' 'user.avatar60' => '//www.intracheck.tk/frontend/web/imagenes/usuarios/profile/60/j8bjr4.gif' 'user.avatar120' => '//www.intracheck.tk/frontend/web/imagenes/usuarios/profile/120/j8bjr4.gif' 'user.avatar240' => '//www.intracheck.tk/frontend/web/imagenes/usuarios/profile/240/j8bjr4.gif' ]

$_SERVER = [ 'REDIRECT_STATUS' => '200' 'HTTP_HOST' => 'www.intracheck.tk' 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0' 'HTTPACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,/_;q=0.8' 'HTTP_ACCEPT_LANGUAGE' => 'es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3' 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate' 'HTTP_COOKIE' => 'BACKENDSESSID=m1hfv2emgg2q68pk152306vgl5; _backendCSRF=2f001c066e118c4a9796a7db6a30ce6261af3eff53aba02ff712abbd27119171a%3A2%3A%7Bi%3A0%3Bs%3A12%3A%22_backendCSRF%22%3Bi%3A1%3Bs%3A32%3A%22wfTNQ9DeHYn4Vhd07w3WxpavZBjwquCi%22%3B%7D' 'HTTP_CONNECTION' => 'keep-alive' 'PATH' => 'C:\imagemagick;C:\ImageMagick;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\ComposerSetup\bin;C:\Php;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;' 'SystemRoot' => 'C:\Windows' 'COMSPEC' => 'C:\Windows\system32\cmd.exe' 'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC' 'WINDIR' => 'C:\Windows' 'SERVER_SIGNATURE' => '' 'SERVER_SOFTWARE' => 'Apache/2.4.12 (Win64)' 'SERVER_NAME' => 'www.intracheck.tk' 'SERVER_ADDR' => '192.168.1.101' 'SERVER_PORT' => '80' 'REMOTE_ADDR' => '192.168.1.101' 'DOCUMENT_ROOT' => 'C:/webs/intracheck' 'REQUEST_SCHEME' => 'http' 'CONTEXT_PREFIX' => '' 'CONTEXT_DOCUMENT_ROOT' => 'C:/webs/intracheck' 'SERVER_ADMIN' => 'root@localhost' 'SCRIPT_FILENAME' => 'C:/webs/intracheck/backend/web/index.php' 'REMOTE_PORT' => '49514' 'REDIRECT_URL' => '/admin' 'GATEWAY_INTERFACE' => 'CGI/1.1' 'SERVER_PROTOCOL' => 'HTTP/1.1' 'REQUEST_METHOD' => 'GET' 'QUERY_STRING' => '' 'REQUEST_URI' => '/admin' 'SCRIPT_NAME' => '/backend/web/index.php' 'PHP_SELF' => '/backend/web/index.php' 'REQUEST_TIME_FLOAT' => 1424910377.252 'REQUEST_TIME' => 1424910377 ] 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\base\Application::bootstrap] Bootstrap with dektrium\user\Bootstrap::bootstrap() 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\base\Module::getModule] Loading module: user 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\base\Module::getModule] Loading module: debug 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\base\Application::bootstrap] Bootstrap with yii\debug\Module::bootstrap() 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\base\Module::getModule] Loading module: gii 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\base\Application::bootstrap] Bootstrap with yii\gii\Module::bootstrap() 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\web\UrlManager::parseRequest] No matching URL rules. Using default URL parsing logic. 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\web\Application::handleRequest] Route requested: 'user/admin/index' 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\base\Controller::runAction] Route to run: user/admin/index 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\base\InlineAction::runWithParams] Running action: backend\controllers\AdminController::actionIndex() 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\web\themes\AdminLTE\views\admin\index.php in C:\webs\intracheck\vendor\dektrium\yii2-user\controllers\AdminController.php:88 2015-02-25 19:56:24 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\web\themes\AdminLTE\views\admin\flash.php in C:\webs\intracheck\backend\web\themes\AdminLTE\views\admin\index.php:26 in C:\webs\intracheck\vendor\dektrium\yii2-user\controllers\AdminController.php:88 2015-02-25 19:56:25 [192.168.1.101][3][-][trace][yii\base\Module::getModule] Loading module: gridview in C:\webs\intracheck\vendor\kartik-v\yii2-krajee-base\Config.php:252 in C:\webs\intracheck\vendor\kartik-v\yii2-krajee-base\Config.php:267 in C:\webs\intracheck\vendor\kartik-v\yii2-grid\GridView.php:658 2015-02-25 19:56:25 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts\main.php in C:\webs\intracheck\vendor\dektrium\yii2-user\controllers\AdminController.php:88 2015-02-25 19:56:25 [192.168.1.101][3][-][trace][yii\rbac\DbManager::checkAccessRecursive] Checking role: Administrador in C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts\main.php:42 in C:\webs\intracheck\vendor\dektrium\yii2-user\controllers\AdminController.php:88 2015-02-25 19:56:25 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts_menuser.php in C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts\main.php:57 in C:\webs\intracheck\vendor\dektrium\yii2-user\controllers\AdminController.php:88 2015-02-25 19:56:25 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts_sidebar.php in C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts\main.php:77 in C:\webs\intracheck\vendor\dektrium\yii2-user\controllers\AdminController.php:88 2015-02-25 19:56:25 [192.168.1.101][3][-][trace][yii\base\View::renderFile] Rendering view file: C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts_footer.php in C:\webs\intracheck\backend\web\themes\AdminLTE\views\layouts\main.php:101 in C:\webs\intracheck\vendor\dektrium\yii2-user\controllers\AdminController.php:88 2015-02-25 19:56:24 [192.168.1.101][3][-][info][application] $_COOKIE = [ 'BACKENDSESSID' => 'm1hfv2emgg2q68pk152306vgl5' '_backendCSRF' => '2f001c066e118c4a9796a7db6a30ce6261af3eff53aba02ff712abbd27119171a:2:{i:0;s:12:\"_backendCSRF\";i:1;s:32:\"wfTNQ9DeHYn4Vhd07w3WxpavZBjwquCi\";}' ]

$_SESSION = [ 'flash' => [] 'returnUrl' => '/admin' '__id' => 3 'user.username' => 'admin' 'user.name' => 'WILMER ANDRES ARAMBULA' 'user.register' => 1415058504 'user.avatar30' => '//www.intracheck.tk/frontend/web/imagenes/usuarios/profile/30/j8bjr4.gif' 'user.avatar60' => '//www.intracheck.tk/frontend/web/imagenes/usuarios/profile/60/j8bjr4.gif' 'user.avatar120' => '//www.intracheck.tk/frontend/web/imagenes/usuarios/profile/120/j8bjr4.gif' 'user.avatar240' => '//www.intracheck.tk/frontend/web/imagenes/usuarios/profile/240/j8bjr4.gif' ]

$_SERVER = [ 'REDIRECT_REDIRECT_STATUS' => '200' 'REDIRECT_STATUS' => '200' 'HTTP_HOST' => 'www.intracheck.tk' 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0' 'HTTPACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,/_;q=0.8' 'HTTP_ACCEPT_LANGUAGE' => 'es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3' 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate' 'HTTP_REFERER' => 'http://www.intracheck.tk/admin' 'HTTP_COOKIE' => 'BACKENDSESSID=m1hfv2emgg2q68pk152306vgl5; _backendCSRF=2f001c066e118c4a9796a7db6a30ce6261af3eff53aba02ff712abbd27119171a%3A2%3A%7Bi%3A0%3Bs%3A12%3A%22_backendCSRF%22%3Bi%3A1%3Bs%3A32%3A%22wfTNQ9DeHYn4Vhd07w3WxpavZBjwquCi%22%3B%7D' 'HTTP_CONNECTION' => 'keep-alive' 'PATH' => 'C:\imagemagick;C:\ImageMagick;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\ComposerSetup\bin;C:\Php;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;' 'SystemRoot' => 'C:\Windows' 'COMSPEC' => 'C:\Windows\system32\cmd.exe' 'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC' 'WINDIR' => 'C:\Windows' 'SERVER_SIGNATURE' => '' 'SERVER_SOFTWARE' => 'Apache/2.4.12 (Win64)' 'SERVER_NAME' => 'www.intracheck.tk' 'SERVER_ADDR' => '192.168.1.101' 'SERVER_PORT' => '80' 'REMOTE_ADDR' => '192.168.1.101' 'DOCUMENT_ROOT' => 'C:/webs/intracheck' 'REQUEST_SCHEME' => 'http' 'CONTEXT_PREFIX' => '' 'CONTEXT_DOCUMENT_ROOT' => 'C:/webs/intracheck' 'SERVER_ADMIN' => 'root@localhost' 'SCRIPT_FILENAME' => 'C:/webs/intracheck/backend/web/index.php' 'REMOTE_PORT' => '49514' 'REDIRECT_URL' => '/backend/web//user/admin/index.html' 'GATEWAY_INTERFACE' => 'CGI/1.1' 'SERVER_PROTOCOL' => 'HTTP/1.1' 'REQUEST_METHOD' => 'GET' 'QUERY_STRING' => '' 'REQUEST_URI' => '/admin/user/admin/index.html' 'SCRIPT_NAME' => '/backend/web/index.php' 'PHP_SELF' => '/backend/web/index.php' 'REQUEST_TIME_FLOAT' => 1424910384.412 'REQUEST_TIME' => 1424910384 ]

samdark commented 9 years ago

Well, it's something internal about Imagine. Can't tell more w/o logs. Try adding try-catch and getting message from exception caught.

tecnologiaterabyte commented 9 years ago

I think I found the problem if placed to view the content:

the problem is in the open:

Debug:

var_dump(self::$_imagine);

show: object(Imagine\Imagick\Imagine)#153 (0) { }

echo ($filename);

Show: C:/webs/intracheck/backend/web/perfil_google.jpg

echo ($box):

Show: 100x100 px

Code BaseImage.php in (Vendor/yiisoft/yii2-imagine).

Line 157:

$img = static::getImagine()->open(Yii::getAlias($filename));

// In Windows //
var_dump($img);

Show: ERR_CONNECTION_RESET

// in Linux Work Fine//

Show: object(Imagine\Imagick\Image)#155 (2) { ["imagick":"Imagine\Imagick\Image":private]=> object(Imagick)#154 (0) { } ["layers":"Imagine\Imagick\Image":private]=> object(Imagine\Imagick\Layers)#156 (4) { ["image":"Imagine\Imagick\Layers":private]=> *RECURSION* ["resource":"Imagine\Imagick\Layers":private]=> object(Imagick)#154 (0) { } ["offset":"Imagine\Imagick\Layers":private]=> int(0) ["layers":"Imagine\Imagick\Layers":private]=> array(0) { } } }

I hope this information you a clue about the problem.

Thks,

samdark commented 9 years ago

It's not. It's Imagine internals, not Yii wrapper so I guess it should be reported to Imagine issue tracker.

tecnologiaterabyte commented 9 years ago

Hi @samdark

Solved add update "imagine/imagine": "0.6.2" the last version, update dependencies yii2-imagine.

Thks,

tecnologiaterabyte commented 9 years ago

@samdark

You can add yii2-imagine the updated library "imagine / Imagine": "0.6.2", that functions with the new library imagick.

Thks,

samdark commented 9 years ago

0.6.* aren't backwards compatible with 0.5.* we're currently using. Set milestone to 2.1 where we can safely update it.

ItsReddi commented 9 years ago

https://github.com/yiisoft/yii2/issues/6014 - https://github.com/yiisoft/yii2/pull/7070

samdark commented 8 years ago

Closed in favor of https://github.com/yiisoft/yii2-imagine/issues/7