Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Sponsored Reviews   High Bandwidth Dedicated Servers   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 04-30-2007, 02:08 AM   #1 (permalink)
Inactive
 
Join Date: 09-07-06
Posts: 25
iTrader: 0 / 0%
Latest Blog:
None

mohammed is liked by many
Preview Images

Hello friends,

How to preview the images before submitted by the users using a form, for example, in a form an user enters his image there should be preview box in the form itself to enable the user to preview the images before they submit, by this procedure they will post wrong images,

Any logic from you will be very helpful.

Thanks.
mohammed is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 04-30-2007, 01:53 PM   #2 (permalink)
Inactive
 
Join Date: 04-10-07
Location: www.webfoyers.com
Posts: 68
iTrader: 0 / 0%
Latest Blog:
None

brealmz is liked by somebodybrealmz is liked by somebodybrealmz is liked by somebody
you need an ajax to do that. server will not know what what the image looks like unless you have uploaded it. i have no idea processing it in client side using javascript but still try googling it.
brealmz is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-30-2007, 03:54 PM   #3 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 2,960
iTrader: 0 / 0%
Latest Blog:
None

Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
Wink Try this one!

HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <script type="text/javascript"> var imgId; var objUpload; function PreviewImage(/*As String*/ objUploadID , /*As String*/ imageID) { objUpload = document.getElementById(objUploadID); imgId = document.getElementById(imageID); imgId.src = objUpload.value; } </script> </head> <body> <input type="file" name="ImageUpload1" size="33" /> <a href="javascript:PreviewImage('ImageUpload1', 'PreviewImage');">Preview Your Image</a> <br> <img id="PreviewImage" /> <br> <br> </body> </html>
Is this what you need?
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-30-2007, 04:19 PM   #4 (permalink)
Inactive
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
Nice, costin_trifan ... but a couple of things make it work better like:
Code:
... function PreviewImage(imageID,imgSrc) { imgId = document.getElementById(imageID); imgId.src = imgSrc; } </script> ... <input type="file" name="ImageUpload1" size="33" onblur="PreviewImage('PrevImage',this.value)" /><br> <img id="PrevImage" />
(PreviewImage was both the name of the function and the ID of the IMG to hold the display, and some browsers have a hard time handling a FILE type form element in the manner you presented it. I used onblur instead of a link, because they'll see it without needing to do anything.)

And why does this work without uploading the file to the server? Well, before they submit the form, the user establishes a path to the file on their own system, and the preview function just grabs that file for local viewing ... no uploading required!
StupidScript is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-30-2007, 04:43 PM   #5 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 2,960
iTrader: 0 / 0%
Latest Blog:
None

Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
I just wanted to show an example


Quote:
There are numbers of ways for coding an app...
The only thing that differentiate us is our point of view.
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
What type of images and royalty free images do developers and webmasters need? EZRoyaltyFree Web Design Lobby 0 02-26-2008 09:11 AM
phpLD 3.3 Preview dvduval Directory Announcements & Promotions 0 01-06-2008 02:09 PM
wordpress preview cimmeron Blogging Forum 23 04-19-2006 05:11 PM
Is there an XML Editor with Preview Mode????? chrisnrach17 Coding Forum 4 07-01-2005 09:02 AM
MSN Tech Preview toolkit SEO Forum 9 10-08-2004 04:01 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 03:39 PM.
© Copyright 2008 V7 Inc