Support

Home Forums Event Espresso Premium Invoice Image Size set to 300px, can't make smaller?

Invoice Image Size set to 300px, can't make smaller?

Posted: July 13, 2023 at 8:37 am

Viewing 4 reply threads


Ryan DesRoches

July 13, 2023 at 8:37 am

Hi, the

#logo-dv img

used on the invoice template seems to be set at 300px and I can’t seem to change it. 300px wide is just too big for our logo and I need to reduce it to 100px wide. The invoice image uploaded is 100pxx100px, but on the invoice it scales to 300×300.

I have tried overriding the style using a custom style in my theme editor. That didn’t work. I then went into the plugin editor and updated

event-espresso-core-reg/modules/gateways/Invoice/lib/templates/base.css

And adjusted that – still no luck.

I also tried editing espresso_replace_invoice_shortcodes in event-espresso-core-reg/modules/gateways/Invoice/lib/Invoice.class.php

To remove the hard-coded width attribute but still no luck.

Any Advice on how to change the image size on these invoices?


Ryan DesRoches

July 13, 2023 at 8:48 am

Link to invoice template I am trying to change looks like this:
https://foxytravel.com/?ee=msg_url_trigger&snd_msgr=html&gen_msgr=html&message_type=invoice&context=purchaser&token=1-ff7cc6916cfa47609009d12f676e2bfb&GRP_ID=2&id=53680


Tony

  • Support Staff

July 14, 2023 at 8:01 am

Hi there,

Can you link me to an invoice for a test registration so I can take a look?
(Note I need the HTML version where the button shows for you to download the PDF, not just the PDF)

Scratch that, me being completely oblivious to your second post!

The [INVOICE_LOGO] shortcode (which I assume you are using, correct?) does this:

// image tags have been requested.
$image_size = @getimagesize($invoice_logo_url);
$image_width_attr = '';
// if image is wider than 300px, set the width to 300
if ($image_size !== false) {
    $image_width = max($image_size[0], 300);
    $image_width = esc_attr($image_width);
    $image_width_attr = " width='$image_width'";
}

Which is basically grabbing the size of the image and using it within the img tags as the width. If the image is greater than 300px wide, it uses 300px, but it should still allow you to set a smaller image as long as that is what has been uploaded, EE will use the smaller version up to 300px.


Tony

  • Support Staff

July 14, 2023 at 10:40 am

Ok, so did a little digging into this and the problem is obvious now…

Inside \event-espresso-core\core\libraries\shortcodes\EE_Transaction_Shortcodes.lib.php

Around line 500 you’ll find the snippet from above.

$image_width = max($image_size[0], 300);

Is incorrect, its the opposite of what it should be.

It should be:

$image_width = min($image_size[0], 300);

Set that in your version and it should fix the logo size for you.

I’ve created a ticket to update our code in the next version.


Ryan DesRoches

July 17, 2023 at 1:09 pm

Tony, Thank you – this worked like a charm. Hopefully a permanent fix will be in the code base soon.

Viewing 4 reply threads

The support post ‘Invoice Image Size set to 300px, can't make smaller?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso