Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Where do you put images to be displayed in a module?Where do you put images to be displayed in a module?
Previous
 
Next
New Post
11/14/2006 12:25 PM
 

What directory do I put my image in so it can be seen inside a custom module?  If I move it to the <install>/DesktopModules/<myModuleFolder>, I can see it from design view of the ascx file, but not when I run the site.  I've tried it all over, so perhaps my problem is with the code itself.  I'm using this in my ascx file:

<img src="imageName.gif" alt="ImageName Logo">

The following line works, but I don't want to use an absolute path:

<img src="http://localhost/DotNetNuke/imageName.gif" alt="imageName Logo"><br />

Thanks.

Mark

 
New Post
11/14/2006 11:55 PM
 

Ahh... always so tricky.

Well, you have a few options.  Generally, I put images in an images directory in my custom module.  The problem is how to get to that directory depends on your starting position.  Consider the typical development installation...

http://localhost/dotnetnuke

Here, my images can be found at /dotnetnuke/desktopmodules/mycustommodule/images

When I publish to my webserver, though, the path changes to /desktopmodules/mycustommodule/images

Generally, it's recommended you reference your image using something like
<img src="~/desktopmodules/mycustommodule/images/myimage.gif">

The problem is that won't be recognized on your development machine unless you installed DNN at http://localhost (omitting the /dotnetnuke directory).  So what's one to do?  Well there are a few hacks like having your images in multiple locations on your local machine so the path resolves, but it seems as I write more and more modules, I just learn to live with the image can't be found X on my dev box and just wait until I push it out to staging server (or anything with a real domain) to see how it all looks.  If all you do on your local machine is develop DNN modules, I'd say just put your install directly at wwwroot and not have to worry about the moving paths.

 

 

 
New Post
11/15/2006 2:01 AM
 

Hi,

Usually I put my images in "~/Portals/" & PortalID  then use:

DotNetNuke.Common.Globals.GetPortalSettings.HomeDirectory

to referene the directory, this means if your Portal is 0 the above will return "<path to DNN Root>/Portals/0/<name.gif>".

I hope this helps

Lee


Lee B
Owner
S@W Designs
Outsourcing partner
Developer forums and Help.
 
New Post
11/15/2006 2:54 PM
 

Thank you Professor

I think I'll follow your lead and write it for the production system, but I tried both ways and it seems to work exactly as you have described.

Thanks again, you've been very helpful to me.

Mark

 
New Post
11/16/2006 10:39 PM
 

Thanks Lee

I didn't see your post when I first addressed this issue.  I tried it and it works like a champ.  I can see it in my development environment, and I assume it will work equally well in a production environment. 

Thanks a bunch.

Mark

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Where do you put images to be displayed in a module?Where do you put images to be displayed in a module?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out