-2

In prestashop when I add a picture as an attachment to a product it saves file in download/filename but the problem is that the filename is without extension

eg. b112ddf78daac05a027abd52e67e8d2d6e6dee0a

How to display picture in html (<img src="">) if filename does not have an extension?

Krzysztof Janiszewski
  • 3,763
  • 3
  • 18
  • 38

2 Answers2

2

I'm assuming you're using the $attachments array to display the image on the product page? Since the extension doesn't matter (the browser looks for the mime type, see more here), you could do the following :

{foreach from=$attachments item=attachment name=attachments}
  <img src="{$link->getPageLink('attachment', true, NULL, "id_attachment={$attachment.id_attachment}")|escape:'html':'UTF-8'}">
{/foreach}
defuzed
  • 568
  • 5
  • 17
1

There is no need for extension. Just pass the variable to src and it's fine.