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.0Images in my moduleImages in my module
Previous
 
Next
New Post
6/28/2006 3:18 PM
 

Hi there,

I have an image which should be shown in my module.  At this moment on my local development machine i have included image by using "add existing items". This works fine for my local machine.

When i pack this module as a pa and install it on my site it will not show properly. Actualy it will turn up as a red cross in an empty image field.

Does anyone know how i can resolve this?

Thanks in advance,

 

Marc


Regards,
Marc

www.biservices.eu for free nl-NL resourcepacks.
 
New Post
7/2/2006 11:13 AM
 

This is a common issue when you are developing on a machine using a virtual directory and then deploying on a machine to a root website.

Let's say your development machine is http://localhost/dotnetnuke and your production machine is http://www.mywebsite.com  To make it exactly the same, you would have to be deploying to http://www.mywebsite.com/dotnetnuke  See the difference?

There are two common ways to resolve this.  The most common is to not worry about broken images in Visual Studio and know they will work when published.  The other option is to make your development environment use your local root website http://localhost  If you choose that option, you will see images in both dev and prod.  If you only work on one website, that's a good option.  For most, though, you need to use virtual directories.

Anyway... to use an image, your image path should be ~/desktopmodules/[modulename]/images/myimage.jpg or whatever the image really is.  The point is, using ~/ will get you to the root and you can specifiy the path from there.  Your local environment will not like this because it's trying to go to something like http://localhost/desktopmodules/[modulename]/images/myimage.jpg and it's not adding your virtual directory in the path.  There are other things you can do, like looking to see if the request is coming from localhost or not and modifying the path based on that.  You could also get your module working using something like ~/dotnetnuke/desktopmodules/[modulename]/images/myimage.jpg and then go back and remove the extra /dotnetnuke just before deployment.

  

 
New Post
7/4/2006 1:09 AM
 

If you want to do it programmatically from the database contents (references to images on your site) use the examples in the events module.

Here is what I use in a GridView (C# version) - which grabs and sets the alt text and image URL info from the database (return from SP actually)

<asp:Image ID="Image2" runat="server" AlternateText='<%# Eval("AltText") %>' ImageUrl='<%# PortalSettings.HomeDirectory.ToString() + (Eval("IconFile").ToString()) %>' Width="50px" />

The key element is the ImageUrl - here is the full template for use in the GV:

<asp:TemplateField HeaderText="img">

<ItemTemplate>

<asp:Image ID="Image2" runat="server" AlternateText='<%# Eval("AltText") %>' ImageUrl='<%# PortalSettings.HomeDirectory.ToString() + (Eval("IconFile").ToString()) %>' Width="50px" />

</ItemTemplate>

</asp:TemplateField>

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Images in my moduleImages in my 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