David Erwin
David Erwin

Reputation: 1280

SVG images displayed as broken images on server

I'm encountering an odd problem showing .svg using simple img tags on Apache.

On my local computer, the images are visible. On my mt VPS, the images come across as broken links. When I right click on a broken image link and 'Open Image', it shows the images correctly (telling me that the path is correct).

My HTML looks like this:

<img width="32" height="32" alt="icon" id="create-wheel-icon2" src="public/assets/img/svg/idea_vect.svg" style="left: 230px; top: 57px; opacity: 1;">

Any thoughts?

Upvotes: 16

Views: 13445

Answers (2)

Treb
Treb

Reputation: 395

The info in link that Robert provided above worked for me:

.htaccess file with these rules:

AddType image/svg+xml svg svgz
AddEncoding gzip svgz

Upvotes: 24

Robert Longson
Robert Longson

Reputation: 124079

Most likely you aren't serving the images with the correct mime type. There's some information on how to do that here: http://kaioa.com/node/45

You could always try to get a png file to work first to make sure it isn't something obvious about where you are putting the images.

Upvotes: 9

Related Questions