mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2025-03-03 13:29:24 +01:00
Bugfix etiketten embedded images
This commit is contained in:
parent
f03a52474d
commit
94043a6609
@ -68,20 +68,27 @@ class EtikettenPDF extends SuperFPDF {
|
||||
break;
|
||||
|
||||
case "image":
|
||||
$filename = '';
|
||||
if(isset($items->attributes()->src))
|
||||
{
|
||||
$src = str_replace('&','&',$items->attributes()->src);
|
||||
if(stripos($src,'http://') === false && stripos($src,'https://') === false)
|
||||
$filename = '';
|
||||
if(isset($items->attributes()->src))
|
||||
{
|
||||
$src = 'http://'.$src;
|
||||
$src = str_replace('&','&',$items->attributes()->src);
|
||||
if(stripos($src,'http://') === false && stripos($src,'https://') === false)
|
||||
{
|
||||
$src = 'http://'.$src;
|
||||
}
|
||||
$content = file_get_contents($src);
|
||||
} else {
|
||||
$content = base64_decode($items[0]);
|
||||
if ($content === false) {
|
||||
throw new RuntimeException('invalid image data');
|
||||
}
|
||||
}
|
||||
$content = file_get_contents($src);
|
||||
|
||||
if($content)
|
||||
{
|
||||
$filename = rtrim($this->app->erp->GetTMP(),'/').'/'.md5(microtime(true).$items[0]);
|
||||
file_put_contents($filename.'1.jpg', $content);
|
||||
|
||||
|
||||
$bildbreite = trim($items->attributes()->width);
|
||||
$bildhoehe = trim($items->attributes()->height);
|
||||
if(!class_exists('image'))include_once(__DIR__.'/../class.image.php');
|
||||
@ -120,9 +127,8 @@ class EtikettenPDF extends SuperFPDF {
|
||||
$manipulator->save($filename.'2.jpg', $typ);
|
||||
$items[0] = $filename.'2.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$type = exif_imagetype ( trim($items[0]) );
|
||||
|
||||
switch($type)
|
||||
@ -132,10 +138,12 @@ class EtikettenPDF extends SuperFPDF {
|
||||
case IMAGETYPE_PNG: $type="png"; break;
|
||||
default: $type="";
|
||||
}
|
||||
|
||||
if($type!="")
|
||||
{
|
||||
$this->Image(trim($items[0]),trim($items->attributes()->x),trim($items->attributes()->y),trim($items->attributes()->width),trim($items->attributes()->height),$type);
|
||||
}
|
||||
|
||||
if($filename != '')
|
||||
{
|
||||
unlink($filename.'1.jpg');
|
||||
|
@ -7,9 +7,10 @@
|
||||
|
||||
<!-- erstes tab -->
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
<fieldset><legend>{|Bild heraufladen|}</legend>
|
||||
<i>Hinweis: Es werden aktuell nur Monochrom PNG Dateien unterstützt. Die Bildbreite muss durch 8 teilbar sein! z.B. 520 Pixel oder 640 Pixel. 800 Pixel entsprechen 10 cm.</i>
|
||||
<i>Hinweis: Es werden aktuell nur JPG-Dateien unterstützt.</i>
|
||||
<table>
|
||||
<tr><td>Datei:</td><td><input type="file" name="image"></td><td><input type="submit" name="submit" value="Hochladen"></td>
|
||||
</tr></table>
|
||||
|
@ -96,14 +96,16 @@ class Etiketten extends GenEtiketten {
|
||||
{
|
||||
if(file_exists($pfad))
|
||||
{
|
||||
$result = $this->app->erp->PNG2Etikett($pfad);
|
||||
if($result['result']=="1")
|
||||
{
|
||||
$this->app->Tpl->Set('BILD',"<textarea rows=\"10\" cols=\"80\"><image x=\"1\" y=\"1\" width=\"".$result['width']."\" height=\"".$result['height']."\">".$result['stream']."</image></textarea>");
|
||||
$this->app->Tpl->Set('BILD2',"<textarea rows=\"10\" cols=\"80\"><label><image x=\"1\" y=\"1\" width=\"".$result['width']."\" height=\"".$result['height']."\">".$result['stream']."</image></label></textarea>");
|
||||
$result = getimagesize($pfad);
|
||||
$stream = base64_encode(file_get_contents($pfad));
|
||||
if($result !== false)
|
||||
{
|
||||
$this->app->Tpl->Set('BILD',"<textarea rows=\"10\" cols=\"80\">\n<image x=\"1\" y=\"1\" width=\"".$result[0]."\" height=\"".$result[1]."\">\n".$stream."\n</image>\n</textarea>");
|
||||
$this->app->Tpl->Set('BILD2',"<textarea rows=\"10\" cols=\"80\">\n<label>\n<image x=\"1\" y=\"1\" width=\"".$result[0]."\" height=\"".$result[1]."\">".$stream."</image>\n</label>\n</textarea>");
|
||||
}
|
||||
else
|
||||
$this->app->Tpl->Set('BILD',"<div class=\"error\">".$result['message']."</div>");
|
||||
else {
|
||||
$this->app->Tpl->Set('MESSAGE',"<div class=\"error\">Datei konnte nicht geladen werden</div>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user