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,15 +68,22 @@ class EtikettenPDF extends SuperFPDF {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "image":
|
case "image":
|
||||||
$filename = '';
|
$filename = '';
|
||||||
if(isset($items->attributes()->src))
|
if(isset($items->attributes()->src))
|
||||||
{
|
|
||||||
$src = str_replace('&','&',$items->attributes()->src);
|
|
||||||
if(stripos($src,'http://') === false && stripos($src,'https://') === false)
|
|
||||||
{
|
{
|
||||||
$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)
|
if($content)
|
||||||
{
|
{
|
||||||
$filename = rtrim($this->app->erp->GetTMP(),'/').'/'.md5(microtime(true).$items[0]);
|
$filename = rtrim($this->app->erp->GetTMP(),'/').'/'.md5(microtime(true).$items[0]);
|
||||||
@ -122,7 +129,6 @@ class EtikettenPDF extends SuperFPDF {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
$type = exif_imagetype ( trim($items[0]) );
|
$type = exif_imagetype ( trim($items[0]) );
|
||||||
|
|
||||||
switch($type)
|
switch($type)
|
||||||
@ -132,10 +138,12 @@ class EtikettenPDF extends SuperFPDF {
|
|||||||
case IMAGETYPE_PNG: $type="png"; break;
|
case IMAGETYPE_PNG: $type="png"; break;
|
||||||
default: $type="";
|
default: $type="";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($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);
|
$this->Image(trim($items[0]),trim($items->attributes()->x),trim($items->attributes()->y),trim($items->attributes()->width),trim($items->attributes()->height),$type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($filename != '')
|
if($filename != '')
|
||||||
{
|
{
|
||||||
unlink($filename.'1.jpg');
|
unlink($filename.'1.jpg');
|
||||||
|
@ -7,9 +7,10 @@
|
|||||||
|
|
||||||
<!-- erstes tab -->
|
<!-- erstes tab -->
|
||||||
<div id="tabs-1">
|
<div id="tabs-1">
|
||||||
|
[MESSAGE]
|
||||||
<form action="" method="post" enctype="multipart/form-data">
|
<form action="" method="post" enctype="multipart/form-data">
|
||||||
<fieldset><legend>{|Bild heraufladen|}</legend>
|
<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>
|
<table>
|
||||||
<tr><td>Datei:</td><td><input type="file" name="image"></td><td><input type="submit" name="submit" value="Hochladen"></td>
|
<tr><td>Datei:</td><td><input type="file" name="image"></td><td><input type="submit" name="submit" value="Hochladen"></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
|
@ -96,14 +96,16 @@ class Etiketten extends GenEtiketten {
|
|||||||
{
|
{
|
||||||
if(file_exists($pfad))
|
if(file_exists($pfad))
|
||||||
{
|
{
|
||||||
$result = $this->app->erp->PNG2Etikett($pfad);
|
$result = getimagesize($pfad);
|
||||||
if($result['result']=="1")
|
$stream = base64_encode(file_get_contents($pfad));
|
||||||
|
if($result !== false)
|
||||||
{
|
{
|
||||||
$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('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\"><label><image x=\"1\" y=\"1\" width=\"".$result['width']."\" height=\"".$result['height']."\">".$result['stream']."</image></label></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('MESSAGE',"<div class=\"error\">Datei konnte nicht geladen werden</div>");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
$this->app->Tpl->Set('BILD',"<div class=\"error\">".$result['message']."</div>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user