www.webdeveloper.com
Results 1 to 5 of 5

Thread: Image preview

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Posts
    4

    Image preview

    Hi

    I am very intrested to know how can i preview an image before the image gets uploaded to the server.In my application i can able to preview the uploaded image in the confimation page only.But how can i make a image preview without page gets refreshed.
    I followed some code but it works only in IE and ask to run ActiveX controls
    Code:
    <HEAD>
    <STYLE type=text/css>#newPreview {
     FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)
    }
    </STYLE>
    <SCRIPT language=javascript type=text/javascript>
       function PreviewImg(imgFile)
    {    
        var newPreview = document.getElementById("newPreview");
        newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
        newPreview.style.width = "80px";
        newPreview.style.height = "60px";
    }
    
    </SCRIPT>
    
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    
    <BODY>
    <input type="file" id="picField" onchange="PreviewImg(this)">
     <div id="newPreview"></div>
    
    </BODY>
    </HTML>
    Is there is any other common process to do this functions in all the browser.Is that possible with the help of YUI(Yahoo user Interface) or any other tools.

    Thanks

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Cross browser image pre-view requires sending the image to the server first, then returning it to the document.
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Apr 2009
    Posts
    4

    Image preview

    Hi
    Thank you for your reply.Is that possible to do this function by Ajax or YUI (Yahoo User Interface).

  4. #4
    Join Date
    Feb 2006
    Posts
    198
    try having a look at jquery and its plugins, it is quite good for UI stuff like this

  5. #5
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Ajax can not upload images nor can JavaScript libraries or frameworks do it.
    It would be possible in Fx if you could convince the user to lower their security restrictions.
    At least 98% of internet users' DNA is identical to that of chimpanzees

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles