473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Image RESIZER SOMBODY PLEASE HELP

ImageResizer.php

Image Resizer 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 [b]((unable to create emp directory)) Here is a site to be able to see script actually 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.
Poppa

The script is as follows

[PHP]
<?
session_start();

$refresh=$_SESSION["REFRESHED"]=($_SESSION["REFRESHED"])?0:1;

$imgsrc = ($_REQUEST["imgsrc"])?
$_REQUEST["imgsrc"]: "sample.jpg";

if (strpos($imgsrc,"sample.jpg")>0)
$imgfile = "sample.jpg";
else
$imgfile = substr($imgsrc, strpos($imgsrc,"/img_edt"));

$__min=base64_decode("RGV2ZWxvcGVkIEJ5IDxhIGlkPSJf X2tpbSIgaHJlZj0iaHR0cDovL3RlY2guY2l0eXBvc3QuY2EiPk NpdHlQb3N0LmNhPC9hPg==")
?>

<html>
<head>
<style>
img {border:none;}
body,table,td {font-family:Arial;font-size:12px}
form {display:inline;}
</style>
<title>Image Cropper / Resizer</title>
<script>
var isIE = (document.all)? true:false;
var minHeight=40, minWidth=40;

var canvasEl, imageEl, selector;
var oldX, oldY;
var mouseMoved;

document.onmousedown = mouseDown;
document.onmousemove = mouseMove;
document.onmouseup = mouseUp;

//------------ FUNCTIONS FOR DRAG AND DROP ----------------------------
//------------- mouseDown, mouseMove, mouseUp, --------------
//------------- grabEl, moveEl, dropEl --------------
function mouseDown(e) {
e = (!e)? window.event : e ;

var targetEl = (isIE)? e.srcElement : e.target;

while (targetEl.id != "image") {
targetEl = targetEl.parentNode;
if (targetEl == null) { return }
}

if (targetEl.id=="image") {
canvasEl = document.getElementById("canvas");
imageEl = document.getElementById("image");
selector = document.getElementById("selector");
oldX = (e.clientX + document.body.scrollLeft);
oldY = (e.clientY + document.body.scrollTop);
mouseMoved=false;
}
else
imageEl == null;

if (isIE)
e.returnValue = false;
else
e.preventDefault();
}

function mouseMove(e) {
e = (!e)? window.event : e ;
if (imageEl == null) { return };

mouseMoved = true;
var imageW = parseInt(imageEl.width, 10 );
var imageH = parseInt(imageEl.height, 10 );

var newX = (e.clientX + document.body.scrollLeft );
var newY = (e.clientY + document.body.scrollTop );

var x = oldX+canvasEl.scrollLeft-parseInt(canvasEl.style.left,10);
var y = oldY+canvasEl.scrollTop-parseInt(canvasEl.style.top,10);
var w = (newX - oldX);
var h = (newY - oldY);

w = Math.min( w, (imageW-x));
h = Math.min( h, (imageH-y));
w = Math.max( w, 1);
h = Math.max( h, 1);

selector.style.display = "block";
selector.style.width = w + "px";
selector.style.height = h + "px";
selector.style.left = x + "px";
selector.style.top = y + "px";
document.getElementById("crop").disabled = false;

document.resizefrm.width.value = w;
document.resizefrm.height.value = h;

document.cropfrm.x.value = x;
document.cropfrm.y.value = y;
document.cropfrm.w.value = w;
document.cropfrm.h.value = h;

if (isIE)
e.returnValue = false;
else
e.preventDefault();

}

function mouseUp(e) {
imageEl = null;
if (mouseMoved==false) {
selector.style.display = "none";
document.getElementById("crop").disabled = true;
}
}

function init() {
if (<?=$refresh?>)
window.location.reload();
var kim = document.getElementById('__kim');
if (kim==null || kim.tagName != "A" || kim.innerHTML<="" ) {
alert("This Image-Editor Version Requires Link To CityPost.ca");
return false;
}
}
</script>

</head>
<body onload="init()">
<div id="canvas" style="position:absolute;top:5px;left:5px;width:80 0px;height:590px;border:1px solid black;overflow:auto;">
<div id="selector" style="display:none;position:absolute;border:1px solid blue;font-size:1px;"></div>
<img id="image" src="<?=$imgsrc?>" />
</div>

<div style="position:absolute;top:5px;left:810px">

<b>HOW TO? 1-2-3</b>
<br><br><b>1. Upload Your Image </b>
<br><font color=blue><?=$_REQUEST["m1"]?></font>
<form method=post action="proc_image_editor.php" ENCTYPE="multipart/form-data">
<input type=file name=imgfile size=10/>
<button type=submit name="upload">Upload Image</button>
</form>

<br><br><b>2. Resize or Crop</b>
<form name=resizefrm method=post action="proc_image_editor.php">
<br>&nbsp; - Drag mouse or type numbers

<table cellpadding=0 cellspacing=0>
<tr><td colspan=4>
<font color=blue><?=$_REQUEST["m2"]?></font>
<tr>
<td>w:<td><input id="width" name="width" size=1/>
<td>h:<td><input id="height" name="height" size=1/><br>
<tr><td><td colspan=3>
<input type="hidden" id="imgfile" name="imgfile" value="<?=$imgfile?>" />
<button type=submit id="resize" name="resize" value="1">
&nbsp; &nbsp; &nbsp; Resize &nbsp; &nbsp;&nbsp;</button>
</table>
</form>

<form name=cropfrm method=post action="proc_image_editor.php">
<table cellpadding=0 cellspacing=0>
<tr><td colspan=4>
<font color=blue><?=$_REQUEST["m3"]?></font>
<tr>
<td>x: <td><input name="x" id="x" size=1 readonly>
<td>y: <td><input name="y" id="y" size=1 readonly>
<tr>
<td>w: <td><input name="w" id="w" size=1 readonly>
<td>h: <td><input name="h" id="h" size=1 readonly>
<tr><td><td colspan=3>
<input type="hidden" id="imgfile" name="imgfile" value="<?=$imgfile?>" />
<button type=submit id="crop" name="crop" value="1" disabled>
Crop Selection</button>
</table>
</form>

<? if ($imgsrc!=="sample.jpg") { ?>
<br><b>3. Save </b>
<br><button
onclick="window.location.href='proc_download.php?f l=<?=$imgsrc?>'">
Download Image
</button>

<br><br><b>4. Go Back </b>
<font color=blue><?=$_REQUEST["m4"]?></font>
<form action="proc_image_editor.php">
<input type="hidden" id="imgfile" name="imgfile" value="<?=$imgfile?>" />
<button type=submit id="recall" name="recall" value="1">
Recall Original
</button>
</form>
<? }?>

<br>Image url : <?=$imgfile?>
<br>
<br><?=$__min?>
<br><?include "/var/www/tech/_google_180_150.inc"?>
</div>
(/PHP/>
</body>
[/PHP]
Dec 13 '06 #1
2 2342
steven
143 100+
The problem isn't with your resize script, it's with your upload script / php config. Have you specified a temp directory in your php.ini and if not, do you have the relevent permissions to write to the systems default temp directory?

You can create your own directory and set it as the temp for php, if that helps.
Dec 14 '06 #2
b1randon
171 Expert 100+
The problem isn't with your resize script, it's with your upload script / php config. Have you specified a temp directory in your php.ini and if not, do you have the relevent permissions to write to the systems default temp directory?

You can create your own directory and set it as the temp for php, if that helps.
For sure. I'd recommend making your own directory too since it isn't very likely that geocities is going to bend over backward to give the account php is running under permissions for folders outside your root in their tree.
Dec 14 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: vunet.us | last post by:
Hello, What is the best image resizing tool is out there? I want to resize images in ASP page when users upload them into some directory. Your recommendations are super welcome. Thank you.
2
by: Michael | last post by:
Hi. I need code that simply resize image with same ratio. My server has ASPImage 1.5 component. Other techniques is appreciated. Michael
2
by: vunet.us | last post by:
I have been using Imager Resizer (http://www.crazybeavers.se/products_imagerresizer.asp) DLL component to handle all my image resizing on server side and delivering a custom-size image to the...
1
by: vovan | last post by:
I need to make my VB 2005 Windows Form application resolution independent. I bought Klik resizer control. But it doesn't work with some Infragistics controls properly. Can anyone suggest any other...
1
by: VUNETdotUS | last post by:
Please, recommend me a good free image resizing tool you've been successfully using up to this date in ASP or ASP.NET. Thanks.
1
by: hemant kamble | last post by:
Hi all, I am hemant , I am new for VB. Can sombody help to access serial port in VB on windows XP. I am trying with Ports.bas but ididn't get success kindly anybody give code for access serial...
0
by: hemant kamble | last post by:
Hi all, I am hemant , I am new for VB. Can sombody help to access serial port in VB on windows XP. I am trying with Ports.bas but ididn't get success kindly anybody give code for access serial...
9
by: Tony Sosa | last post by:
Does anyone know what kind of tweaks I need to make to pertinent configs to render an image correctly? Right now, the text of the argument passed to imagejpeg is being shown instead of the image...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.