Jump to content

Changing the Logo from .jpg to .png


Recommended Posts

Well, it seems an easier solution just to rename your image from logo.png to logo.jpg for example, but if you want to change the code you can do it by modifying the header.tpl file of the theme that you use. The path to the file would be root/themes/mobile_evolution/header.tpl. Then in that file find the following code:

 

<a id="header_logo" href="{$link->getPageLink('index.php')}" title="{$shop_name|escape:'htmlall':'UTF-8'}">
 <img class="logo" src="{$img_ps_dir}logo.jpg?{$img_update_time}" alt="{$shop_name|escape:'htmlall':'UTF-8'}" {if $logo_image_width}width="{$logo_image_width}"{/if} {if $logo_image_height}height="{$logo_image_height}" {/if} />
   </a>

and change logo.jpg with logo.png.

 

When you edit template files, in order to be able to see the change on the frontend, you have to enable the Force Compile option. You can do this from the back office>Preferences tab>Performance sub-tab. After you're done disable it because otherwise it will slow down your site considerably.

 

Hope this helps.

  • Like 1
Link to comment
Share on other sites

  • 4 months later...
  • 2 months later...

There is no need to go and change the .tpl file. Once you have enabled in the prefs that .png can be used (middle option: use PNG only if etc... ), just go to the first tab in the prefs and upload your png. The thing is, even when you have done this, the html generated will still refer to a JPG. Strange eh? The fact is, it doesn't matter. If you check with FTP in the img folder on the server, you will see that the logo.jpg was recently updated. Prestashop uploaded the png and renamed it logo.jpg. The extension of the file itself doesn't matter. Just clear the cache in your browser and it should work!

Link to comment
Share on other sites

I haven't checked your php, but you misunderstood me: if you check on the server with a ftp client the logo.jpg file before and after you upload the .png via the admin control panel, you will see that instead of having the filesize of the .jpg you had before, you will get the filesize of the .png. What I am saying is that it is still a file called logo.jpg, but it actually CONTAINS a .png.

 

And I can assure you that it is rendered as .png (with transparency!!!) on Prestashop. So yes, the feature works.

Edited by NichoTL (see edit history)
Link to comment
Share on other sites

You are right. And I haven't checked your php but I am convinced that it does what you say it does.

 

BUT you are not listening! It is not needed! Just because it changes the extension from logo.png to logo.jpg, it doesn't mean that the file becomes a PNG. It's just an file extension! The file is still a PNG. And is still displayed as a PNG even if its name is .jpg.

 

The file logo.jpg on the server is just a container that can hold a JPG AS WELL AS a PNG. And a PNG contained in logo.jpg will be rendered as a PNG, not a JPG. With transparency.

Link to comment
Share on other sites

×
×
  • Create New...