Fix: reencoding preview tabs, Imagick is a class today
This commit is contained in:
parent
f35b2887b4
commit
a6e61492bc
@ -166,32 +166,8 @@ if ($_GET["id"] > 0)
|
|||||||
{
|
{
|
||||||
if (class_exists("Imagick"))
|
if (class_exists("Imagick"))
|
||||||
{
|
{
|
||||||
$image=new Imagick();
|
$ret = dol_convert_file($file);
|
||||||
$image->readImage($file) ;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
/*
|
|
||||||
if ( imagick_iserror( $handle ) )
|
|
||||||
{
|
|
||||||
$reason = imagick_failedreason( $handle ) ;
|
|
||||||
$description = imagick_faileddescription( $handle ) ;
|
|
||||||
|
|
||||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$image->setImageFormat("PNG");
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ( imagick_iserror( $handle ) )
|
|
||||||
{
|
|
||||||
$reason = imagick_failedreason( $handle ) ;
|
|
||||||
$description = imagick_faileddescription( $handle ) ;
|
|
||||||
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$image->writeImage($file.".png");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -647,4 +647,34 @@ function dol_remove_file_process($filenb,$donotupdatesession=0)
|
|||||||
return $mesg;
|
return $mesg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert file to image
|
||||||
|
*/
|
||||||
|
function dol_convert_file($file,$ext='png')
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
$image=new Imagick();
|
||||||
|
$ret = $image->readImage($file);
|
||||||
|
if ($ret)
|
||||||
|
{
|
||||||
|
$ret = $image->setImageFormat($ext);
|
||||||
|
if ($ret)
|
||||||
|
{
|
||||||
|
$ret = $image->writeImage( $file . "." . $ext );
|
||||||
|
if (! $ret) return -3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user