How to display an image in a SharePoint 2010 Web Part
Asked Answered
S

1

6

I would like to know how to display a local image in my SharePoint 2010 Web Part. I don't really know which url to write in the css.

Shipwright answered 25/2, 2011 at 19:34 Comment(2)
local image in layouts folder or images library?Jennajenne
I don't actually know where to place it in order to display it in the webpart...I've got the image in a folder "images" in my webpart's folder. Which is the best way, and how do I do that? Thanks!Shipwright
P
17
  1. Add SharePoint "Images" mapped folder to the project in Visual Studio. enter image description here

  2. Create a WEB-PART-NAME folder inside (to keep related images together and not overwrite some other image by accident).

  3. Place the image in this folder.

  4. Use the following URL: /_layouts/images/WEB-PART-NAME/IMAGE-FILENAME.png

Perchance answered 26/2, 2011 at 12:28 Comment(1)
VS creates the project-specifically-named folder for you automatically. When I followed step 1, it creaed an Images folder with a subfolder with the same name as the project.Keary

© 2022 - 2024 — McMap. All rights reserved.