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 LinkClick.aspx?fileticketDisplay images LinkClick.aspx?fileticket
Previous
 
Next
New Post
3/1/2013 3:14 PM
 

Using DNN 6

I have read many posts and have not yet found a solution that works.

I have several images uploaded to a Secure Database Folder which I can render with the HTML module. However, I wish to display the images in a basic custom ascx control.

In my control I have the following code which does not display the image in the browser. The image shows as a broken image.

<%@ Control language="vb" Inherits="ImageTestSecureDbFolder.View" CodeFile="View.ascx.vb" AutoEventWireup="false" Explicit="True" %>

<
asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" SelectCommand="SELECT * FROM [Files] WHERE FileID=265"></asp:SqlDataSource>

<
asp:DataList ID="DataList1" runat="server" DataKeyField="FileId" DataSourceID="SqlDataSource1">
    <ItemTemplate>
      <img alt="" src="http://localhost/variousapptests/linkclick.aspx?fileticket=<%# Eval("Content") %>" />
    </ItemTemplate>
</asp:DataList>

Would someone please be so kind to show me what the code should look like in the ascx control.  Is there code behind that is also required --- what should this look like.

Thank you.

 
New Post
3/1/2013 4:11 PM
 
This is the wrong approach. The src on your img needs to point to a server resource that will deliver the image. AFAIK linkclick only does that for resources that are files on disk.

I have built one of these, but I am also persuaded that it is too easy to screw up and too hard to do safely and securely. I installed the wonderful Image Resizer and everything was wonderful.

http://imageresizing.net/

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
3/2/2013 10:21 AM
 
Thanks Richard,

Actually when an image has been uploaded to the Secure Database Folder and is then inserted to the HTML module the actual code is automatically generated and looks something like this:

img alt="" src="/variousapptests/LinkClick.aspx?fileticket=6YUeion4S7o%253d&amp;portalid=0" 

---or--- 
img alt="" src="/variousapptests/LinkClick.aspx?fileticket=6YUeion4S7o%253d"

It does not seem to matter if the portalid is in the line of code or not.

As far as using the recommended Image Resizer, I don’t see how this will fill the need. I do not wish to edit the images in any way through the basic custom ascx control. I only wish to display multiple images along with various other elements.

I was looking for some help with code in the ascx control as well as the code behind to display the images that were uploaded to the Secure Database Folder.

I have read many posts that talk about using DotNetNuke.Common.Globals.LinkClick("FileID=" + FileId.ToString(), TabId, ModuleId,false ---but--- Dnn 6 does not seem to use TabId or ModuleId when automatically generating the code in the HTML module. Also, I am not certain how to implement “DotNetNuke.Common.Globals.LinkClick” into the ascx control or code behind.

Can you or perhaps anyone else show me what the code should look like in the ascx control and code behind?

Thank you.

 
New Post
3/2/2013 10:38 AM
 
Ok then I am not understanding what you mean.

By Secure Database Folder I *thought* you meant that the images were in the database and hence 'secure' compared with being standard files in the file system.

Now I think you mean that the files are in the file system and you simply want to find out how the HTML module does it. If so why not download the DNN source and look at the code for the HTML module?

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
3/2/2013 10:52 AM
 
Hi Richard,

On Localhost: Using the DNN file manager I upload images to a Secure Database Folder. This upload adds a new line to the DnnFilesTable with the content field showing 'binary' as the data.


When I look at the actual folder in the localhost directory structure the folder is empty. My understanding is that the file is stored in the DnnFileTable in a 'binary' format and not in the actual folder that is in the server directory structure.

Regards
Mike
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDisplay images LinkClick.aspx?fileticketDisplay images LinkClick.aspx?fileticket


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