PDF invoice

  • Posts: 8
  • Thank you received: 0
  • Hikashop Business
1 hour 49 minutes ago #372000

-- HikaShop version -- : 6.4.1
-- Joomla version -- : 6.1
-- PHP version -- : 8.4
-- Browser(s) name and version -- : Edge Version 148.0.3967.70
-- Error-message(debug-mod must be tuned on) -- : No image in invoice.php / pdf

Hi team,

today I am trying to change the layout etc in invoice.pdf

But I cant get my image to show in the pdf.

Please can you let me know what I need to do?

I am using the invoice.php in: plugins/hikashop/attachinvoice/attachinvoice

My code:
<!-- STORE LOGO -->
<?php
$logoPath = JPATH_ROOT . '/images/xxx.jpg';
?>
<?php if (is_file($logoPath)) : ?>
<div style="text-align:left; margin-bottom:20px;">
<img src="<?php echo $logoPath; ?>" style="width:300px; height:auto;" alt="Logo">
</div>
<?php else : ?>
<div style="color:red; font-size:10px;">
Logo not found: <?php echo $logoPath; ?>
</div>
<?php endif; ?>
<!-- EO STORE LOGO -->

All I am getting is this colored square in the attached image file :(



Kind regards
Hans Peter Betzler

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
  • Hikashop Business
50 minutes ago #372004

Hi team,
thanks to ChatGPT i got a code that works.

Would you like to tell me please is this code save to use?

<!-- STORE LOGO -->
<?php
$logoPath = JPATH_ROOT . '/images/logo/logo.jpg';

if (is_file($logoPath)) {
$logoData = base64_encode(file_get_contents($logoPath));
$logoInfo = getimagesize($logoPath);

if ($logoInfo !== false) {
$mime = $logoInfo;
?>
<div style="text-align:left; margin-bottom:20px;">
<img
src="data:<?php echo $mime; ?>;base64,<?php echo $logoData; ?>"
style="width:170px; height:auto;"
>
</div>
<?php
}
}
?>
<!-- EO STORE LOGO -->


Kind regards
Hans Peter Betzler

Please Log in or Create an account to join the conversation.

Time to create page: 0.151 seconds
Powered by Kunena Forum