Jump to content

display svg instead of png


Recommended Posts

I see, however png/jpeg images are just archived images with a limited resolution even if this is 1MB or 12MB.

SVG as you stated is a vectorized approach that can scale infinitely

 

Because the png/jpeg... image is just a representation of "something" with a limited number of px => the image can't be converted properly to svg. There are websites that offer online image to svg converters but as you can test for yorself it doesn't work the way you want.

 

The solution I see is just use higher res images, the internet speed has increased tremendously and you can configure presta to use them properly.

 

By the way please check your presta settings in Preferences->images

there you have 2 settings: JPEG quality which needs to be 100 and PNG quality which needs to be 0 for best quality

Link to comment
Share on other sites

Hi Radu, I think I may have confused you. I have vectors for all my png files, I was wondering if there was a module that would show the svg images for browsers that were capable and png for those that are not. So there's 2 elements to the module, 1 checking if browser is svg compatible and 2 displaying the relevant image dependent upon the outcome of the check. I can't believe more people dont use svgs, theyre much smaller in file size than their png/jpg/gif cousins and better quality.

 

Thanks

Will

Link to comment
Share on other sites

I see, I don't know of such a module but technically it can be created, a new field to upload your svg file and display it in front end instead of the images if browser support it.

 

For my curiosity, how do you created the svg files, what do they show? You are right few people use them, I use them for graphics only so me included :(

Link to comment
Share on other sites

Hi Radu you can open edit and export using Adobe Illustrator - this xplains it a little more - http://quintaldesigns.com/articles/svg-files-in-adobe-illustrator stands for scalable vector graphic

 

Basically they will be the default graphics file in the future, small, infinitely scalable without deteriorating and if you include text in them it can be found by search engines - no need for alt tags!

 

So I just need someone to create the module ;)

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

  • 1 year later...
  • 1 year later...
  • 4 months later...

It's simple to do. Just upload the logo.svg to your theme and then change the src in themes/default-bootstrap/header.tpl at around line 107 to link to the SVG file:

										<img class="logo img-responsive" src="{$logo_url}" alt="{$shop_name|escape:'html':'UTF-8'}"{if isset($logo_image_width) && $logo_image_width} width="{$logo_image_width}"{/if}{if isset($logo_image_height) && $logo_image_height} height="{$logo_image_height}"{/if}/>
Link to comment
Share on other sites

  • 7 months later...

I have SVG files I would like to use instead of bitmap files for product illustrations, as well as logos.

 

I am not interested in converting pictures to SVG's, other specialized software does that.

 

Prestashop will not upload SVG files for product illustrations and/or use them.  

 

Is there a module or upgrade that will permit SVGs to be used as well as bitmap files?

Link to comment
Share on other sites

  • Ambassadors, 
  • I need to put a svg logo on my footer, how can i do that?

I can put the svg logo in the header, but in the footer it's not working, can you help me?

 

my site: www.iivarlden.com.br

 

Thanks!

 

I'm not aware of any modules or overrides that allow SVG product images. Changing the logo to an SVG is easy, but changing product images is quite difficult.

 

  • Ambassadors, 
  • I need to put a svg logo on my footer, how can i do that?

I can put the svg logo in the header, but in the footer it's not working, can you help me?

 

my site: www.iivarlden.com.br

 

Thanks!

Link to comment
Share on other sites

I see you're using a module to add that footer logo. Unfortunately, I'm not familiar with that module, so I can't be specific. I would suggest uploading an SVG file to your server and then changing that module's TPL file to link to that SVG file.

Link to comment
Share on other sites

I don't think that's the right way to do it. I think you're better off adding the SVG URL to the <img> tag instead of trying to draw an SVG over the top of the PNG image.
 
For example, on the website I created here, I use the following code:
<img class="logo img-responsive" src="{$img_dir}logo.svg" alt="{l s='Logo'}" onerror="this.src='{$img_dir}logo.png'" width="143" height="123">

Then you put the logo.svg and logo.png files in the themes/<your_theme>/img directory. Adjust the image height, filenames and classes as necessary.

Link to comment
Share on other sites

 

I don't think that's the right way to do it. I think you're better off adding the SVG URL to the <img> tag instead of trying to draw an SVG over the top of the PNG image.
 
For example, on the website I created here, I use the following code:
<img class="logo img-responsive" src="{$img_dir}logo.svg" alt="{l s='Logo'}" onerror="this.src='{$img_dir}logo.png'" width="143" height="123">

Then you put the logo.svg and logo.png files in the themes/<your_theme>/img directory. Adjust the image height, filenames and classes as necessary.

 

Works perfect!!! Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...