Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Where to place webpart reference images?

  Asked By: Evan    Date: Jun 02    Category: Sharepoint    Views: 2267

We have a query: where we need to place reference images of sharepoint
webpart. At present we have placed on SPS folder(physical location as
'myImageFolder') now our problem is the webpart images comes only on
Top SPS site that too on homepage only.
If I tried to place any other places, image not found error comes.
Can anybody help on this issue?



4 Answers Found

Answer #1    Answered By: Johnny Cruz     Answered On: Jun 02

I use the this.ClassResourcePath for Web Part images. If deployed
locally, the images  will be placed into a subdirectory of the
wpresources directory under the home directory of the IIS Web Site. If
deployed globally, the images will be placed into the virtual directory
_wpresources in the 60 hive.

Answer #2    Answered By: Norman Santos     Answered On: Jun 02

This works great, but remember to include your image  files in the manifest.xml and set the build type to "content" for the images.

addition to the manifest.xml:

<ClassResource FileName="image.gif"/>

Answer #3    Answered By: Jamar Yates     Answered On: Jun 02

Thanks. its Great!.. I also have tried to place  the image  folder in
60\template\images folder.(/_layouts/images/myImagefolder/), images
works fine. but some reference  javascript file also placed in
wpresources folder. it works fine. only drawback is need to deploy as
seperate exe/run application. Is this approach is not recommended or
we have to stick to the approach which todd has mensioned!

Answer #4    Answered By: Aaron Lopez     Answered On: Jun 02

Yes, it works well for JavaScript, XML, CSS, images, etc. Any external
file-based resource that your Web Part may need.

Yes, I would not recommend deploying your images  anywhere in the 60
hive. Use the wpresources directory which is a sibling to the root of
the 60 hive. That is its intended use. And as you say, deploying
anywhere else requires an additional deployment.

You will read in some documentation that you can construct your own
ASP.NET applications in the _layouts directory. I also recommend against
this. Remember, the 60 hive is fair game for Microsoft to alter, update,
replace entirely, spindle, fold, mutilate, etc. They warn us not to mess
with most of its content. If we do want to change the way things work we
should create our own subdirectory as you suggest.

Didn't find what you were looking for? Find more on Where to place webpart reference images? Or get search suggestion and latest updates.