|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
looking for image parsing script
I was wondering if anyone knew of a perl or shell script that would parse an html document, find all references to images and prepend text to that reference in the original document.
Example: before parsing the html: img src="/images/spacer.gif" after parsing the html: img src="www.someserver.com/df3e567d6f16d040326c7a0ea29a4f41/images/spacer.gif" Any help will be much appreciated! |
|
#2
|
|||
|
|||
|
Quote:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Image Upload</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="http://levade.homeip.net/fszone/forums/cache/css_1.css" rel="stylesheet" type="text/css"> <!-- waiting for php corrections <script language='Javascript'> function replace(string,text,by) { var strLength = string.length, txtLength = text.length; if ((strLength == 0) || (txtLength == 0)) return string; var i = string.indexOf(text); if ((!i) && (text != string.substring(0,txtLength))) return string; if (i == -1) return string; var newstr = string.substring(0,i) + by; if (i+txtLength < strLength) newstr += replace(string.substring(i+txtLength,strLength),text,by); return newstr; } function doact(a, d) { if (a == 's') { var dod = eval("document.result."+d); dod.focus(); dod.select(); } else if (a == 'c') { var doc = eval("document.result."+d); cp = doc.createTextRange(); doc.focus(); doc.select(); cp.execCommand("Copy"); } else if (a == 'v') { var dob = eval("document.result."+d); var c = dob.value; code = replace(c,'<','<'); code = replace(code,'>','>'); code = replace(code,'<br>','\n'); code = replace(code,'\n','<br>'); nwin = open('', 'Code', 'toolbar=no,location=no,scrollbars=yes,resizable=no,statusbar=no,top=0,width=500,height=500'); nwin.document.open(); nwin.document.write("<title>View Code</title><style type='text/css'><!--a:link {color: #000000;text-decoration: none;}a:visited {color: #000000;text-decoration: none;}a:hover {color: #000000;text-decoration: underline;}.table {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 9px;color: #000000;}input {font-family: Verdana;font-size: 9px;color: #000000;background-color: #A2AEC5;border: 1px solid #000000;}.textarea {font-family: Verdana;font-size: 9px;color: #000000;background-color: #A2AEC5;border: 1px solid #000000;}.hidden {VISIBILITY: hidden; POSITION: static}.show {VISIBILITY: visible; POSITION: static} </style><body bgcolor='#7A8AAA'><center><div align='justify'><table width='90%' height='211' border='0' align='center' cellpadding='3' cellspacing='3' class='table' style='background-color: #8E9EBA; border: 1px solid black'><tr><td align='justify' valign='top'>"); nwin.document.write(code); nwin.document.write("</td></tr></table><center><p><span style='font-family: Verdana; font-size: 9px; color: #000000;'><a href='javascript:location.reload()'>Reload</a> - <a href='javascript:self.close()'>Close Window</a></span></div>"); nwin.document.close(); } } </script>--> </head> <body> <table width="100%" cellspacing="1" id="submenu" align="right"> <tr> <td valign="top"> <img src="http://levade.homeip.net/fszone/forums/style_images/1/tile_back_small.gif" width="100%" height="22"> <font size="4" color="3A4F6C"> <div align="center"> Upload <br> </font> <font size="1" color="3A4F6C"> <!--Upload form--> <?php error_reporting(0); $site_name = $_SERVER['HTTP_HOST']; $url_dir = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']); $url_this = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; $upload_dir = "upload_files/"; $upload_url = $url_dir."/upload_files/"; $message =""; //create upload_files directory if not exist //If it does not work, create on your own and change permission. if (!is_dir("upload_files")) { die ("upload_files directory doesn't exist"); } if ($_FILES['userfile']) { $message = do_upload($upload_dir, $upload_url); } else { $message = ""; } print $message; function do_upload($upload_dir, $upload_url) { $temp_name = $_FILES['userfile']['tmp_name']; $file_name = $_FILES['userfile']['name']; $file_type = $_FILES['userfile']['type']; $file_size = $_FILES['userfile']['size']; $result = $_FILES['userfile']['error']; $file_url = $upload_url.$file_name; $file_path = $upload_dir.$file_name; //File Name Check if ( $file_name ==".jpg,.gif,.avi,.zip,.rar") { $message = "Invalid File Name Specified, be sure its a '.jpg,.gif,.avi,.zip,.rar'"; return $message; } //File Size Check else if ( $file_size > 50000000) { $message = "The file size is too big."; return $message; } //File Type Check else if ( $file_type == "text/plain" ) { $message = "Sorry, You cannot upload any script file" ; return $message; } $result = move_uploaded_file($temp_name, $file_path); $message = ($result)?"[IMG]<a href=$file_url>$file_url</a>[/IMG]" : "Somthing is wrong with uploading the image."; return $message; } ?> <form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post"> <br><br> Upload Image <br> <input type="file" id="userfile" name="userfile"> <input type="submit" name="upload" value="Upload"> </form> </font> <br> <font size="2" color="red"> Please Click Upload Only ONCE! May Take A While To Upload! </font> <br><br> <font size="3" color="3A4F6C"> Please Note The Following Guidelines: <br> </font> <font size="1.5" color="3A4F6C"> - Max picture size of 500 KB's <br> - Only accepts '.jpg' <br> -If you have problems please <a href="mailto:Martymydog@aol.com?subject=Image Uploader&">E-Mail us</a>. (Martymydog@aol.com) </div> </font> <br><br> </td> </tr> </table> </body> </html> |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > looking for image parsing script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|