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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDisplay Images from Database Using Image PathDisplay Images from Database Using Image Path
Previous
 
Next
New Post
4/27/2011 8:34 PM
 

Issue in displaying images (jpg, gif, etc) in a GridView, using the image path saved in a MSSQL database table.
Sample code:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" >

 <Columns>

 <asp:ImageField DataImageUrlField="imageUrl"> </asp:ImageField>

 <asp:BoundField DataField="description" HeaderText="Description"/>

 </Columns>

 </asp:GridView>

Used DNN's standard methods to DataBind the GridVIew. The locations (e.g, ~\image\myCat.gif) of the images are in the column, ImageUrl.
This works perfectly in a normal ASP.net (3.5) application. But the same code is not working when used in a DNN Module. Also tried the full path of image, instead of relative one shown above, without any success.
So what’s the modification for this code to get it to work in DNN module? Or is there any better way to do this in DNN? (I want to avoid storing images in binary format in the database, since it causes loss of image quality.) Any suggestions/help, greatly appreciated!

A purpose of this would be, to have the users upload their pictures to a folder, with some description of the image, which later can be retrieved and displayed.
Thanks!

 
New Post
5/4/2011 5:35 PM
 
So what actual image url gets bound?

How is that different to what you expected?

Your quoted image url looks somewhat odd (\ instead of /).

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
5/4/2011 5:37 PM
 
Why does storing a binary image in the DB have any effect on quality? 

I would expect it to be the exact same bits as you would have in the equivalent disk file.  What am I missing?

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
5/4/2011 9:08 PM
 
The issue with the DNN module is, nothing is displayed for the image column on the website. But its description is shown correctly, meaning data is retrieved correctly from the database. But as mentioned in the previous post, the same code works in a normal ASP.net application.

Regarding your second question about storing a binary image in the database, this article/blogs may explain: http://www.codeproject.com/KB/aspnet/GridImage.aspx

So, what’s your recommended way to save/retrieve images and description using DNN modules?

Thanks,
Sam
 
New Post
5/4/2011 9:48 PM
 
Sam,

When you say that the images are not displaying . . . do you see the typical missing image icon? If so, right click on it, select properties, and tell us what is the url shown for the image's src attribute?

Alternatively, when you view the page's source what is being rendered for the html image tag?

Is "~\images\myCat.gif" a typical value for the database table's ImageUrl column? If so, as Richard indicated, it should be "~/images/myCat.gif" - note the forward not back slashes.

Where are the actual image files located? If you have uploaded them via the DNN File Manager or are using the DNN URL control or other DNN upload control in your custom module, they will NOT be uploaded into the site's images folder as that folder is generally reserved for system images. Uploaded files (image and otherwise) will normall be placed in a sub-folder of the portal's home directory - for example "/Portals/0/MyImages/myCat.gif". In that case, a typical value in the ImageUrl column of your database table would be "~/Portals/0/MyImages/myCat.gif".

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDisplay Images from Database Using Image PathDisplay Images from Database Using Image Path


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