开发者

weird failure with "PhpThumbFactory"

开发者 https://www.devze.com 2023-02-15 10:32 出处:网络
I\'m using the PhpThumbFactory-library inside of my Zend-Framework application. And it seems to execute (!?) the generated image file as PHP.

I'm using the PhpThumbFactory-library inside of my Zend-Framework application. And it seems to execute (!?) the generated image file as PHP.

Error:

[07-Mar-2011 11:20:20] PHP Warning: Unexpected character in input: '' (ASCII=16) state=0 in path\uploads\thumbs\3.jpg on line 52

[07-Mar-2011 11:20:20] PHP Parse error: syntax error, unexpected ']' inpath\uploads\thumbs\3.jpg on line 52

Source:

require_once APPLICATION_PATH . "/../library/ThumbLib.inc.php";
try
{
    $thumb = P开发者_开发百科hpThumbFactory::create(APPLICATION_PATH . '/../uploads/' . $result . '.jpg', array("correctPermissions"=>true));
    $thumb->resize(240, 200);
    $thumb->save(APPLICATION_PATH . '/../uploads/thumbs/' . $result . '.jpg');
} catch (Exception $e)
{
    var_dump($e);
}

I'm really curious. :/


The solution was to write a custom function to handle the GD operations... This library (PhpThumbFactory) seems to mess things up badly.


In my application the warning you show above (Unexpected character in input: '' (ASCII=16) state=0) was caused by creating an empty string with double quotes, so:

$var = ""; // Causes the warning
$var = ''; // No warning

Hope this helps someone else.

0

精彩评论

暂无评论...
验证码 换一张
取 消