@@ -97,7 +97,7 @@ public function resetY_axis($arraydata) {
9797 }
9898
9999 public function SetY_axis ($ arraydata ) {
100- if ((JasperPHP \Instructions::$ y_axis + (int ) $ arraydata ['y_axis ' ]) <= JasperPHP \Instructions::$ arrayPageSetting ["pageHeight " ]) {
100+ if ((JasperPHP \Instructions::$ y_axis + (int )$ arraydata ['y_axis ' ]) <= JasperPHP \Instructions::$ arrayPageSetting ["pageHeight " ]) {
101101 JasperPHP \Instructions::$ y_axis = JasperPHP \Instructions::$ y_axis + (int )$ arraydata ['y_axis ' ];
102102 }
103103 }
@@ -214,43 +214,47 @@ public function Ellipse($arraydata) {
214214
215215 public function Image ($ arraydata ) {
216216 //echo $arraydata["path"];
217- $ path = $ arraydata ["path " ];
218- $ imgtype = mb_substr ($ path , -3 );
219- $ arraydata ["link " ] = $ arraydata ["link " ] . "" ;
220- if ($ imgtype == 'jpg ' )
221- $ imgtype = "JPEG " ;
222- elseif ($ imgtype == 'png ' || $ imgtype == 'PNG ' )
223- $ imgtype = "PNG " ;
224- // echo $path;
225- $ imagePath = str_replace (array ('" ' ,'\\' ,'/ ' ),array ('' ,DIRECTORY_SEPARATOR ,DIRECTORY_SEPARATOR ) ,$ path );
226- //not full patch?
227- if (!file_exists ($ imagePath )) {
228- $ imagePath = getcwd ().DIRECTORY_SEPARATOR .$ imagePath ;
229- }
230- if (file_exists ($ imagePath )) {
231-
232- //echo $imagePath;
233- //exit;
234- JasperPHP \Instructions::$ objOutPut ->Image ($ imagePath , $ arraydata ["x " ] + JasperPHP \Instructions::$ arrayPageSetting ["leftMargin " ], $ arraydata ["y " ] + JasperPHP \Instructions::$ y_axis , $ arraydata ["width " ], $ arraydata ["height " ], $ imgtype , $ arraydata ["link " ], '' , false , 300 , '' , false , false , $ arraydata ["border " ] , $ arraydata ["fitbox " ]);
235- }elseif ( mb_substr ($ path , 0 , 4 ) == 'http ' ){
236- // echo $path;
237- ///exit;
238- JasperPHP \Instructions::$ objOutPut ->Image ($ path , $ arraydata ["x " ] + JasperPHP \Instructions::$ arrayPageSetting ["leftMargin " ], $ arraydata ["y " ] + JasperPHP \Instructions::$ y_axis , $ arraydata ["width " ], $ arraydata ["height " ], $ imgtype , $ arraydata ["link " ], '' , false , 300 , '' , false , false , $ arraydata ["border " ] , $ arraydata ["fitbox " ]);
239- } elseif (mb_substr ($ path , 0 , 21 ) == "data:image/jpg;base64 " ) {
240- $ imgtype = "JPEG " ;
241- //echo $path;
242- $ img = str_replace ('data:image/jpg;base64, ' , '' , $ path );
243- $ imgdata = base64_decode ($ img );
244- JasperPHP \Instructions::$ objOutPut ->Image ('@ ' . $ imgdata , $ arraydata ["x " ] + JasperPHP \Instructions::$ arrayPageSetting ["leftMargin " ], $ arraydata ["y " ] + JasperPHP \Instructions::$ y_axis , $ arraydata ["width " ], $ arraydata ["height " ], '' , '' , '' , false , 300 , '' , false , false , $ arraydata ["border " ] ,$ arraydata ["fitbox " ]);
245- } elseif (mb_substr ($ path , 0 , 22 ) == "data:image/png;base64, " ) {
246- $ imgtype = "PNG " ;
247- // JasperPHP\Pdf::$pdfOutPut->setImageScale(PDF_IMAGE_SCALE_RATIO);
248-
249- $ img = str_replace ('data:image/png;base64, ' , '' , $ path );
250- $ imgdata = base64_decode ($ img );
251-
252-
253- JasperPHP \Instructions::$ objOutPut ->Image ('@ ' . $ imgdata , $ arraydata ["x " ] + JasperPHP \Instructions::$ arrayPageSetting ["leftMargin " ], $ arraydata ["y " ] + JasperPHP \Instructions::$ y_axis , $ arraydata ["width " ], $ arraydata ["height " ], '' , $ arraydata ["link " ], '' , false , 300 , '' , false , false , 0 ,$ arraydata ["fitbox " ]);
217+ $ this ->print_expression ($ arraydata );
218+ if ($ this ->print_expression_result == true ) {
219+
220+ $ path = $ arraydata ["path " ];
221+ $ imgtype = mb_substr ($ path , -3 );
222+ $ arraydata ["link " ] = $ arraydata ["link " ] . "" ;
223+ if ($ imgtype == 'jpg ' )
224+ $ imgtype = "JPEG " ;
225+ elseif ($ imgtype == 'png ' || $ imgtype == 'PNG ' )
226+ $ imgtype = "PNG " ;
227+ // echo $path;
228+ $ imagePath = str_replace (array ('" ' , '\\' , '/ ' ), array ('' , DIRECTORY_SEPARATOR , DIRECTORY_SEPARATOR ), $ path );
229+ //not full patch?
230+ if (!file_exists ($ imagePath )) {
231+ $ imagePath = getcwd () . DIRECTORY_SEPARATOR . $ imagePath ;
232+ }
233+ if (file_exists ($ imagePath )) {
234+
235+ //echo $imagePath;
236+ //exit;
237+ JasperPHP \Instructions::$ objOutPut ->Image ($ imagePath , $ arraydata ["x " ] + JasperPHP \Instructions::$ arrayPageSetting ["leftMargin " ], $ arraydata ["y " ] + JasperPHP \Instructions::$ y_axis , $ arraydata ["width " ], $ arraydata ["height " ], $ imgtype , $ arraydata ["link " ], '' , false , 300 , '' , false , false , $ arraydata ["border " ], $ arraydata ["fitbox " ]);
238+ } elseif (mb_substr ($ path , 0 , 4 ) == 'http ' ) {
239+ // echo $path;
240+ ///exit;
241+ JasperPHP \Instructions::$ objOutPut ->Image ($ path , $ arraydata ["x " ] + JasperPHP \Instructions::$ arrayPageSetting ["leftMargin " ], $ arraydata ["y " ] + JasperPHP \Instructions::$ y_axis , $ arraydata ["width " ], $ arraydata ["height " ], $ imgtype , $ arraydata ["link " ], '' , false , 300 , '' , false , false , $ arraydata ["border " ], $ arraydata ["fitbox " ]);
242+ } elseif (mb_substr ($ path , 0 , 21 ) == "data:image/jpg;base64 " ) {
243+ $ imgtype = "JPEG " ;
244+ //echo $path;
245+ $ img = str_replace ('data:image/jpg;base64, ' , '' , $ path );
246+ $ imgdata = base64_decode ($ img );
247+ JasperPHP \Instructions::$ objOutPut ->Image ('@ ' . $ imgdata , $ arraydata ["x " ] + JasperPHP \Instructions::$ arrayPageSetting ["leftMargin " ], $ arraydata ["y " ] + JasperPHP \Instructions::$ y_axis , $ arraydata ["width " ], $ arraydata ["height " ], '' , '' , '' , false , 300 , '' , false , false , $ arraydata ["border " ], $ arraydata ["fitbox " ]);
248+ } elseif (mb_substr ($ path , 0 , 22 ) == "data:image/png;base64, " ) {
249+ $ imgtype = "PNG " ;
250+ // JasperPHP\Pdf::$pdfOutPut->setImageScale(PDF_IMAGE_SCALE_RATIO);
251+
252+ $ img = str_replace ('data:image/png;base64, ' , '' , $ path );
253+ $ imgdata = base64_decode ($ img );
254+
255+
256+ JasperPHP \Instructions::$ objOutPut ->Image ('@ ' . $ imgdata , $ arraydata ["x " ] + JasperPHP \Instructions::$ arrayPageSetting ["leftMargin " ], $ arraydata ["y " ] + JasperPHP \Instructions::$ y_axis , $ arraydata ["width " ], $ arraydata ["height " ], '' , $ arraydata ["link " ], '' , false , 300 , '' , false , false , 0 , $ arraydata ["fitbox " ]);
257+ }
254258 }
255259 }
256260
0 commit comments