Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

Image upload - problems and a proposed solution
Last Post 02-23-2011 09:52 AM by Ryan Bakerink. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Informative
Sotiris FilippidisUser is Offline
skipping stones
skipping stones
Posts:14
Avatar

--
02-20-2011 10:32 AM
    I've been having trouble with image upload fields when using initial sql rendering/bind and thumbnails with preview. I'm copying the description of the problem and the solution I came up with from my blog post at http://dnnuke.blogspot.com and I would like to hear your thoughts on the matter:

    This may not interest lots of people, but if you're using the very powerful DataSprings' Dynamic Forms module you may come across it.

     

    The setup

     

    Historycally, there have been quite a few bugs with the image upload field in this module, especially when using in combined with the Preview functionality. I had the following setup:

     

    Dynamic Forms module with more than one image upload field.

    Preview ON

    Thumbnail ON

    Initial SQL rendering/bind ON

    More than one image fields

     

    Other attributes for image fields (not that it matters, just describing the full scenario):

    Custom image folder

    Save filename only

    Save system generated unique name

     

    I wanted to setup Dynamic Forms to let a user upload, let's say, four images on the same form. I needed to save those in my own database tables and load them from those tables, so I had initial SQL rendering/bind as well as an sql event to save the images back to my custom database table.

     

    The problem

     

    When you use your own sql query to get data for your form, (at least at versions 03.30 to 03.40) thumbnails do not get loaded the first time the form is loaded. Instead, you see the full-sized image (after all, that's what stored in the database).

     

    If you cause a postback (e.g. by clicking on the "upload new image" link on another image field) then the image url is correctly prefixed with "thumb_" and it is presented in the correct dimensions.

     

    The solution

     

    To overcome this, I just added code to my select query that would put the "_thumb" prefix in place even if it wasn't there, like the following:

     

    SELECT

      field1

    , field2

    , ...(other fields)

    , case

      when ltrim(rtrim(isnull(myfield,''))) =''

      then ''

      else 'thumb_' + myfield

      end as myfield

    , ...(other fields)

    ...(rest of query)

     

    So this would always add the thumb_ prefix to the field "myfield".

     

    This solved the problem with the initial form rendering. The first time a user sees the form, the thumbnails are shown instead of the full images.

     

    The second problem

     

    The first solution caused an additional problem: In the case of a postback, as I mentioned before, DF puts its own "thumb_" prefix in the images that are displayed on image fields! So if you attempt to click on "upload new image" in any fields, all the other fields will now have an image starting with "thumb_thumb_", and, since no filename exists that starts with this prefix, broken images will be all you'll see.

     

    Please note that you'll see this only if you're using two or more image fields on the same form (or use any other postback that triggers this behaviour).

     

    The additional solution

     

    I found no way to circumvent this, since it's by design. So I had to resort to JQuery in order to correct the problem. I added a Custom Javascript (you can do that in the Module Configuration section) like the following one:

     

    $(document).ready(function() {

        $('img[src*="/Portals/0/imageuploadfolder/"]').each(function(i,d) { 
        
            $(d).attr("src", 
                     $(d).attr("src").replace("thumb_thumb_", "thumb_") 
                     );

        }); 
    }); 

    What it does is take all images that have an src attribute that contains the path /portals/0/imageuploadfolder (replace this with your path) and changes any double "thumb_" prefixes to a single one.

     

    This dual workaround seems to work good so far. Now I know this is a very special situation (Dynamic Forms with more than one image field and initial sql rendering) but I hope someone benefits from this. Take care.


    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    02-23-2011 09:52 AM
    Thank you for the contributed knowledge!

    If you ever have any questions pleas let us know.

    Thanks,

    Ryan
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way
    Subscribe Me

    Recent Blogs...

     
    Copyright 2005 - 2011 by Data Springs, Inc.
     
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi