SunQuest
           PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old December 12th, 2006, 03:59 PM
Poppa Pimp Poppa Pimp is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: TN USA
Posts: 2 Poppa Pimp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ImageResizer.php

ImageResizer.php

Image Resizer v52 PLEASE HELP
The URL of the page this is on in my site is http://poppa-pimps-wallpapers.com//ImageResizer.php You can click on browse and get image,but when you upload image it will go to another page and says ((unable to create emp directory)) Here is a site to be able to see script work http://tech.tailoredweb.com/image-editor-52/ and can be DL from there also. I am using FP 2003 and geocities pro Domain site. When downloading script I have 2 files that match another with same name diffrent content cant upload to geocities pro replaces previous file.Hope you can help with this if you have time.
Poppa

The script is as follows

php Code:
Original - php Code
  1.  
  2. <?
  3.  
  4. $refresh=$_SESSION["REFRESHED"]=($_SESSION["REFRESHED"])?0:1;
  5.  
  6. $imgsrc = ($_REQUEST["imgsrc"])?
  7.     $_REQUEST["imgsrc"]: "sample.jpg";
  8.    
  9. if    (strpos($imgsrc,"sample.jpg")>0)   
  10.     $imgfile = "sample.jpg";
  11. else
  12.     $imgfile = substr($imgsrc, strpos($imgsrc,"/img_edt"));
  13.  
  14. $__min=base64_decode("RGV2ZWxvcGVkIEJ5IDxhIGlkPSJfX2tpbSIgaHJlZj0iaHR0cD  ovL3RlY2guY2l0eXBvc3QuY2EiPkNpdHlQb3N0LmNhPC9hPg==  ") 
  15. ?>
  16.  
  17. <html>
  18. <head>
  19. <style>
  20.     img {border:none;}
  21.     body,table,td {font-family:Arial;font-size:12px}
  22.     form {display:inline;}
  23. </style>
  24. <title>Image Cropper /  Resizer</title>
  25. <script>
  26. var isIE = (document.all)? true:false;
  27. var minHeight=40, minWidth=40;
  28.  
  29. var canvasEl, imageEl, selector;
  30. var oldX, oldY;
  31. var mouseMoved;
  32.  
  33. document.onmousedown = mouseDown;
  34. document.onmousemove = mouseMove;
  35. document.onmouseup =  mouseUp;
  36.  
  37. //------------ FUNCTIONS FOR DRAG AND DROP ----------------------------
  38. //------------- mouseDown, mouseMove, mouseUp,  --------------
  39. //------------- grabEl, moveEl, dropEl       --------------
  40. function mouseDown(e) { 
  41.     e = (!e)? window.event : e ;
  42.    
  43.     var targetEl = (isIE)? e.srcElement : e.target;
  44.  
  45.     while (targetEl.id != "image") {
  46.         targetEl = targetEl.parentNode;
  47.         if (targetEl == null) { return }
  48.     }
  49.  
  50.     if (targetEl.id=="image") {
  51.         canvasEl = document.getElementById("canvas");
  52.         imageEl = document.getElementById("image");
  53.         selector = document.getElementById("selector")
  54.         oldX = (e.clientX + document.body.scrollLeft);
  55.         oldY = (e.clientY + document.body.scrollTop);
  56.         mouseMoved=false;
  57.     }
  58.     else
  59.         imageEl == null;
  60.  
  61.     if (isIE)
  62.         e.returnValue = false;
  63.     else
  64.         e.preventDefault();
  65. }
  66.  
  67. function mouseMove(e) {
  68.     e = (!e)? window.event : e ;
  69.     if (imageEl == null) { return };
  70.    
  71.     mouseMoved = true;
  72.     var imageW = parseInt(imageEl.width, 10 );
  73.     var imageH = parseInt(imageEl.height, 10 );
  74.  
  75.     var newX = (e.clientX + document.body.scrollLeft );
  76.     var newY = (e.clientY + document.body.scrollTop );
  77.    
  78.     var x = oldX+canvasEl.scrollLeft-parseInt(canvasEl.style.left,10);
  79.     var y = oldY+canvasEl.scrollTop-parseInt(canvasEl.style.top,10);
  80.     var w = (newX - oldX);
  81.     var h = (newY - oldY);
  82.  
  83.     w = Math.min( w, (imageW-x));
  84.     h = Math.min( h, (imageH-y));
  85.     w = Math.max( w, 1);
  86.     h = Math.max( h, 1);
  87.    
  88.     selector.style.display = "block";
  89.     selector.style.width = w + "px";
  90.     selector.style.height = h + "px";
  91.     selector.style.left = x + "px";
  92.     selector.style.top =  y + "px";
  93.     document.getElementById("crop").disabled = false;
  94.    
  95.     document.resizefrm.width.value = w;
  96.     document.resizefrm.height.value = h;
  97.  
  98.     document.cropfrm.x.value = x;
  99.     document.cropfrm.y.value = y;
  100.     document.cropfrm.w.value = w;
  101.     document.cropfrm.h.value = h;
  102.  
  103.     if (isIE)
  104.         e.returnValue = false;
  105.     else
  106.         e.preventDefault();
  107.  
  108. }
  109.  
  110. function mouseUp(e) {
  111.     imageEl = null;
  112.     if (mouseMoved==false) {
  113.         selector.style.display = "none";
  114.         document.getElementById("crop").disabled = true;
  115.     }
  116. }
  117.  
  118. function init() {
  119.     if (<?=$refresh?>)
  120.         window.location.reload();
  121.   var kim = document.getElementById('__kim');
  122.   if (kim==null || kim.tagName != "A" || kim.innerHTML<="" ) {
  123.     alert("This Image-Editor Version Requires Link To CityPost.ca");
  124.     return false;
  125.   }   
  126. }
  127. </script>
  128.  
  129. </head>
  130. <body onload="init()">
  131. <div id="canvas" style="position:absolute;top:5px;left:5px;width:800px;hei  ght:590px;border:1px solid black;overflow:auto;">
  132.     <div id="selector" style="display:none;position:absolute;border:1px solid blue;font-size:1px;"></div>
  133.     <img id="image" src="<?=$imgsrc?>" />
  134. </div>
  135.  
  136. <div style="position:absolute;top:5px;left:810px">
  137.  
  138.         <b>HOW TO? 1-2-3</b>
  139.         <br><br><b>1. Upload Your Image </b>
  140.         <br><font color=blue><?=$_REQUEST["m1"]?></font>
  141.         <form method=post action="proc_image_editor.php" ENCTYPE="multipart/form-data">
  142.             <input type=file name=imgfile size=10/>
  143.             <button type=submit name="upload">Upload Image</button>
  144.         </form>
  145.  
  146.         <br><br><b>2. Resize or Crop</b>
  147.         <form name=resizefrm method=post action="proc_image_editor.php">
  148.         <br>&nbsp; - Drag mouse or type numbers
  149.    
  150.         <table cellpadding=0 cellspacing=0>
  151.             <tr><td colspan=4>
  152.                 <font color=blue><?=$_REQUEST["m2"]?></font>
  153.             <tr>           
  154.                 <td>w:<td><input id="width" name="width" size=1/>
  155.                 <td>h:<td><input id="height" name="height" size=1/><br>
  156.             <tr><td><td colspan=3>
  157.                 <input type="hidden" id="imgfile" name="imgfile" value="<?=$imgfile?>" />
  158.                 <button type=submit id="resize" name="resize" value="1">
  159.            &nbsp; &nbsp; &nbsp; Resize &nbsp; &nbsp;&nbsp;</button>
  160.         </table>
  161.         </form>
  162.        
  163.         <form name=cropfrm method=post action="proc_image_editor.php">
  164.         <table cellpadding=0 cellspacing=0>
  165.             <tr><td colspan=4>
  166.                 <font color=blue><?=$_REQUEST["m3"]?></font>
  167.             <tr>
  168.                 <td>x: <td><input name="x" id="x" size=1 readonly>
  169.                 <td>y: <td><input name="y" id="y" size=1 readonly>
  170.             <tr>
  171.                 <td>w: <td><input name="w" id="w" size=1 readonly>
  172.                 <td>h: <td><input name="h" id="h" size=1 readonly>
  173.             <tr><td><td colspan=3>
  174.                 <input type="hidden" id="imgfile" name="imgfile" value="<?=$imgfile?>" />
  175.                 <button type=submit id="crop" name="crop" value="1" disabled>
  176.                 Crop Selection</button>
  177.         </table>
  178.         </form>
  179.  
  180. <? if ($imgsrc!=="sample.jpg") { ?>
  181.         <br><b>3. Save </b>
  182.     <br><button
  183.          onclick="window.location.href='proc_download.php?fl=<?=$imgsrc?>'">
  184.          Download Image
  185.       </button>
  186.  
  187.         <br><br><b>4. Go Back </b>
  188.         <font color=blue><?=$_REQUEST["m4"]?></font>
  189.         <form action="proc_image_editor.php">
  190.             <input type="hidden" id="imgfile" name="imgfile" value="<?=$imgfile?>" />
  191.             <button type=submit id="recall" name="recall" value="1">
  192.                 Recall Original
  193.             </button>
  194.         </form>
  195. <? }?>
  196.  
  197.         <br>Image url : <?=$imgfile?>
  198.     <br>
  199.     <br><?=$__min?>
  200.     <br><?include "/var/www/tech/_google_180_150.inc"?>
  201.     </div>
  202.  
  203. </body>

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > ImageResizer.php


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |