added file to mysite/images/icons but not rendering

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 3.3.1

Question: uploaded an svg file to mysite/images/icons on the server

Details of your query go here

uploaded an svg file to mysite/images/icons on the server, but referencing the file thru silverstripe does not show the rendering of the file/logo. I can access and see that the file uploaded successfuly, when accessing the

image address:
www.domain.com/mysite/images/icons/r4.svg

// Include any relevant code. If you have a lot of code, link to a gist instead.

Hi @tuff-fuel, can you expand on what you mean by:

Are you trying to use the image in a template or…? Could you share some code please?

Hi @JonoM

by reference, meaning referencing the file name, thru the Silverstripe interface.

e.g. file name = rv.svg (attached)

unfortunately don have access to the server at the moment

So you manually enter the name of an icon in the CMS, then where/how are you trying to render it? In a template if you’re in the context of that Page you should be able to do something like <img src="/mysite/images/icons/$IconName" />

Side note: You probably know this but files that live outside the assets folder aren’t accessible to Silverstripe as File objects, so you can’t attach them in a has_one relationship or do image manipulations etc. You might want to consider refactoring so that your SVGs are in the File store, so you can access e.g. $MySVGFile.Link. Alternatively, (no refactor, just for convenience) you could replace your text input for Icon Name with a dropdown field populated with the names of SVGs that exist in that folder - you could get those by looping over the folder with low level PHP. Takes out the human error factor.

i see.

I agree with --> "if you’re in the context of that Page you should be able to do something like <img src="/mysite/images/icons/$IconName" />"

the odd situation is that i have no access to any files on the server and am working straight from the SS interface. Seeing as how other pages/links followed this simliar behavior/route (enter name of svg file in Icon Name field, upload svg file to mysite/images/icons), I was hoping to do the same, but wasnt sucessful (see screenshot)ss23

For that graphic you supplied, can you post the rendered HTML for that whole area? Interested to see what the output is.

the uploading of the file was done by a colleague

yes heres the html area:

oops:

Browse by Category

						<li><a href="/nutrition/products/greens-force/"><img src="mysite/images/icons/gf.svg" width="33" height="33" alt="Greens Force"></a> <a href="/nutrition/products/greens-force/">Greens Force</a></li>
					
						<li><a href="/nutrition/products/base/"><img src="mysite/images/icons/b.svg" width="33" height="33" alt="Base"></a> <a href="/nutrition/products/base/">Base</a></li>
					
						<li><a href="/nutrition/products/soil/"><img src="mysite/images/icons/s.svg" width="33" height="33" alt="Soil"></a> <a href="/nutrition/products/soil/">Soil</a></li>
					
						<li><a href="/nutrition/products/granular/"><img src="mysite/images/icons/g.svg" width="33" height="33" alt="Granular"></a> <a href="/nutrition/products/granular/">Granular</a></li>
					
						<li><a href="/nutrition/products/granular1-5/"><img src="mysite/images/icons/g.svg" width="33" height="33" alt="Granular"></a> <a href="/nutrition/products/granular1-5/">Granular</a></li>
					
						<li><a href="/nutrition/products/granular1-2/"><img src="mysite/images/icons/g.svg" width="33" height="33" alt="Granular"></a> <a href="/nutrition/products/granular1-2/">Granular</a></li>
					
						<li><a href="/nutrition/products/reserve/"><img src="mysite/images/icons/rv.svg" width="33" height="33" alt="Reserve"></a> <a href="/nutrition/products/reserve/">Reserve</a></li>
					
				
				
			</ul>
		</div>
	</div>

current rendering on the staging site:
ss33

Hmmm. I don’t see a ‘broken’ link icon for the image and you say that navigating to the image URL works, so I’m wondering if actually the SVG is loading just fine, but it has not been created properly - e.g. it is not responsive so it’s not rendering as expected? Can you share a link to the live SVG file and/or a live link to the see the problem?

actually im finding on the Sources tab the following:

poorrooting.svg (renders on sources tab) attached

rv.svg (no render on sources tab)

but oddly navigating to the actual image url mysite/images/icons/rv.svg I can see the image in chrome.

my colleague also mentioned on the server that some of the files have different permissions (yesterdays attempt = r4.svg)

You can also check the network tab when loading that page to see if you’re getting an error response on rv.svg. If not, then must be a problem with the SVG itself.

rv.svg (no render on sources tab)

my colleague also mentioned on the server that some of the files have different permissions (yesterdays attempt = r4.svg)image%20(25)

I produced this svg file thru photoshop, but i dont recall doing this step, now wondering if i need to recreate the svg file again

Julieanne Kost's Blog | Import SVG file into Photoshop CC.

Yeah, it looks like a problem with the SVG file rather than anything to do with Silverstripe.

thanks @JonoM

at this point it appeared that a permissions issue with files was the problem. I guess there was a restriction on permissions, so far correcting that seems to have solved the problem

Oh good! I admit I’m surprised - for a permissions problem I would expect an error response but it looks like you got a valid response from the server for rv.svg (10.3kb / 445x445 / image/svg+xml) - but whatever - if it’s working now that’s great :tada: