Fix: reencoding preview tabs, Imagick is a class today
This commit is contained in:
parent
f35b2887b4
commit
a6e61492bc
@ -166,48 +166,24 @@ 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++;
|
||||||
|
}
|
||||||
/*
|
else
|
||||||
if ( imagick_iserror( $handle ) )
|
{
|
||||||
{
|
$langs->load("other");
|
||||||
$reason = imagick_failedreason( $handle ) ;
|
print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
|
||||||
$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
|
|
||||||
{
|
|
||||||
$langs->load("other");
|
|
||||||
print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print "</td>";
|
print "</td>";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
|
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
|
||||||
print '<td align="right" colspan="2"><b>'.price($object->price).'</b></td>';
|
print '<td align="right" colspan="2"><b>'.price($object->price).'</b></td>';
|
||||||
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
print '<td>'.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
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