i tryed it at the beginning of the script after the decleration of $partypicture.
the only problem left with the script is that it doesn't work dynamic.
i even try to compare the the static and the dynamic $partypicture variable , and their both the same ,
maybe i have to change something with the script but what:
here is the script maybe anybody has an idea ?
and the variable$memberbild works
<?php
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////// //////////////////////////
////////////////////////// 1 2 CROP IMAGE //////////////////////////
////////////////////////// //////////////////////////
////////////////////////// (c) 2002 Roel Meurders //////////////////////////
////////////////////////// mail:
scripts@roelmeurders.com //////////////////////////
////////////////////////// version 0.2 //////////////////////////
////////////////////////// //////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
///// CREDITS: Most Javascript is taken from DHTMLCentral.com and is made by Thomas Brattli. ///////
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
// SET VARIABLES ///////////////////////////////////////////////////////////////////////////////////
$tempfoto = $HTTP_GET_VARS['partybild'];
$fotoid = $HTTP_GET_VARS['fotoid'];
$userid = $HTTP_GET_VARS['userid'];
$catnr = $HTTP_GET_VARS['catnr'];
$seqnr = $HTTP_GET_VARS['seqnr'];
if ($fotoid == 1){
$memberbild =$userid.'_pic.jpg';
}else{
$memberbild = $userid.'_pic'.$fotoid.'.jpg';
}
$org = "../../upload/party/full/".$tempfoto; //where the original can be found (incl fullpath);
$res = "../../upload/".$memberbild; //how the result should be saved (incl fullpath);
$crw = 112; // sets the heigth to crop to;
$crh = 150; // sets the heigth to crop to;
$maxwinw = 500; //Sets the maxmimum width for displaying the original while cropping
$maxwinh = 500; //Same, only this time it's the height
$jpegqual = 80; //Sets the jpeg quality
$redirect = "12cropimage.php"; //Sets the file to which the forms should be posted Change you include this file in another.
$javafile = "12cropimage.js"; //Relative path to js-file
$gdversion = 2; // set to 2 if you have gd2 installed
$spacer = "spacer.gif"; //Relactive path tpo spacer.gif, transparent image
$txt['cropimage'] = "ausschneiden";
$txt['preview'] = "Vorschau";
$txt['bigger'] = "+";
$txt['smaller'] = "-";
$txt['closewindow'] = "Fenster schließen";
$txt['selectioninpicture'] = "Die Auswahl muß das Bild betreffen.";
////////////////////////////////////////////////////////////////////////////////////////////////////
// GET PROPORTIONS /////////////////////////////////////////////////////////////////////////////////
if ($crA != "nada"){
$size = getimagesize($org);
$trueW=$size[0];
$trueH=$size[1];
if($trueH<$maxwinh && $trueW<$maxwinw){
$imgH = $trueH;
$imgW = $trueW;
$imgProp = 1;
} else {
if (($maxwinh/$maxwinw) < ($trueH/$trueW)){
$imgH = $maxwinh;
$imgW = ($maxwinh / $trueH) * $trueW;
$imgProp = $trueH / $imgH;
} else {
$imgW = $maxwinw;
$imgH = ($maxwinw / $trueW) * $trueH;
$imgProp = $trueW / $imgW;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTION TO SHOW THE USER INTERFACE /////////////////////////////////////////////////////////////
function CR_showUI(){
global $txt, $imgW, $imgH, $imgProp, $spacer, $redirect, $javafile, $crw, $crh, $org, $res;
?>
<html>
<head>
<title>Crop image</title>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<script language="JavaScript" src="<?=$javafile?>"></script>
<script language="JavaScript">
<!--
function libinit(){
obj=new lib_obj('cropDiv')
obj.dragdrop()
}
function cropCheck(crA){
if ((((obj.x + obj.cr)-11) <= <?=$imgW?>)&&(((obj.y + obj.cb)-11) <= <?=$imgH?>)&&(obj.x >= 11)&&(obj.y >= 11)){
var url = '<?=$redirect?>?&crA='+crA+'&org=<?=$org?>&res=<?= $res?>&crw=<?=$crw?>&crh=<?=$crh?>&l='+(obj.x-11)+'&t='+(obj.y-11)+'&s='+obj.cr;
if (crA == 'pre'){
window.open(url,'prevWin','width=<?=$crw?>,height= <?=$crh?>');
} else {
location.href=url;
}
} else {
alert('<?=$txt['selectioninpicture']?>');
}
}
function stopZoom() {
loop = false;
clearTimeout(zoomtimer);
}
function cropZoom(dir) {
loop = true;
prop = <?=$crh?> / <?=$crw?>;
zoomtimer = null;
direction = dir;
if (loop == true) {
if (direction == "in") {
if ((obj.cr > <?=($crw/$imgProp)?>)&&(obj.cb > <?=($crh/$imgProp)?>)){
cW = obj.cr - 1;
cH = parseInt(prop * cW);
obj.clipTo(0,cW,cH,0,1);
}
} else {
if ((obj.cr < (<?=$imgW?>-5))&&(obj.cb < (<?=$imgH?>-5))){
cW = obj.cr + 1;
cH = parseInt(prop * cW);
obj.clipTo(0,cW,cH,0,1);
}
}
zoomtimer = setTimeout("cropZoom(direction)", 10);
}
}
onload=libinit;
// -->
</script>
<style>
body{font-family:arial,helvetica; font-size:11px}
#cropDiv{ position:absolute; left:11px; top:11px; width:<?=($crw/$imgProp)?>px; height:<?=($crh/$imgProp)?>px; z-index:2; background-image: url(<?=$spacer?>); }
</style>
<link href="../../styles/sqhstyle.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#9dbcfd" text="#000066" link="#000066" alink="#000066" vlink="#000066" marginwidth="10" marginheight="10" topmargin="10" leftmargin="10">
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" align="left" valign="top"><IMG SRC="<?=$redirect?>?crA=img&org=<?=$org?>&res=<?=$ res?>&crw=<?=$crw?>&crh=<?=$crh?>" border="0"></td>
</tr>
<tr>
<td colspan="2"><img src="<?=$spacer?>" border=0 height="5" width="5"></td>
</tr>
<tr>
<td width="228" align="right" class="font1">
<div align="left">
<p class="font1"><font color="#000000"><strong>Profilbild Generator Schritt 2/3</strong></font></p>
</div></td>
<td width="272" align="right">
<input name="Submit1" type="button" class="button" onclick="cropCheck('def');" value="<?=$txt['cropimage']?>">
<input name="Submit2" type="button" class="button" onclick="cropCheck('pre');" value="<?=$txt['preview']?>">
<input name="Submit3" type="button" class="button" onMouseDown="cropZoom('in');" onMouseUp="stopZoom();" value="<?=$txt['smaller']?>">
<input name="Submit4" type="button" class="button" onMouseDown="cropZoom('out');" onMouseUp="stopZoom();" value="<?=$txt['bigger']?>">
</td>
</tr>
<tr>
<td align="right" class="font2"><div align="left"><font color="#000000"></font></div></td>
<td align="right" class="font2"> </td>
</tr>
<tr>
<td align="right" class="font2"><div align="left"><font color="#000000"><strong>Wie funktionierts:</strong> </font></div></td>
<td align="right" class="font2"> </td>
</tr>
<tr class="font2">
<td colspan="2" align="right" valign="top"><font color="#000000"> </font>
<div align="justify"><font color="#000000">Geh mit dem Mauszeiger auf das Rote Rechteck und platzier es an einer gewünschten Stelle auf dem Bild. <br>
Um den Ausschnitt zu vergrößern b.z.w zu verkleinern kannst du die <strong>"+"</strong> und die<strong> "-" </strong>Taste benützen. <br>
Mit der Taste <strong>"Vorschau"</strong> kannst du Dein Bild anschauen bevor es hochgeladen wird. <br>
Hast Du eine entgültige Auswahl getroffen, dann kannst Du mit der Taste<strong> "ausschneiden" </strong>Dein Foto in Dein Profil hochladen</font></div></td>
</tr>
</table>
<div id="cropDiv">
<table width="100%" height="100%" border="1" bordercolor="#FF0000" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td><img src="<?=$spacer?>"></td>
</tr>
</table>
</div>
</body>
</html>
<?
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTION TO SHOW THE CROP PREVIEW ///////////////////////////////////////////////////////////////
function CR_showPrev($t,$l,$s){
global $txt, $imgW, $imgH, $redirect, $crh, $crw, $org, $res;
?>
<html>
<head>
<title>Vorschau</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="top.focus();">
<a href="#" onClick="top.close();"><img alt="<?=$txt['closewindow']?>" src="<?=$redirect?>?crA=crop&org=<?=$org?>&res=<?= $res?>&crw=<?=$crw?>&crh=<?=$crh?>&l=<?=$l?>&t=<?= $t?>&s=<?=$s?>" border=0></a>
</body>
</html>
<?
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTION TO ACTUALLY MAKE THE CROP //////////////////////////////////////////////////////////////
function CR_make_crop($l,$t,$s,$w,$h){
global $org,$imgProp, $gdversion;
$l1 = ceil($imgProp * $l);
$t1 = ceil($imgProp * $t);
$s1 = ceil($imgProp * $s);
$s2 = ceil(($h / $w)* $s1);
if ($gdversion == 2){
$new = imagecreatetruecolor($w,$h);
} else {
$new = imagecreate($w,$h);
}
$img = imagecreatefromjpeg ($org);
imagecopyresized ($new, $img, 0, 0, $l1, $t1, $w, $h, $s1, $s2);
imagedestroy($img);
return $new;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// SCRIPT CONTROL VIA VARIABLE $crA ////////////////////////////////////////////////////////////////
switch($crA){
case img:
header("Content-Type: image/jpeg");
$im = CR_make_crop(0,0,($trueW/$imgProp),$imgW,$imgH);
imagejpeg($im,"",$jpegqual);
imagedestroy($im);
exit;
case crop:
header("Content-Type: image/jpeg");
$im = CR_make_crop($l,$t,$s,$crw,$crh);
imagejpeg($im,"",$jpegqual);
imagedestroy($im);
exit;
case pre:
CR_showPrev($t,$l,$s);
exit;
case def:
$org = $HTTP_GET_VARS['org'];
$res = $HTTP_GET_VARS['res'];
$im = CR_make_crop($l,$t,$s,$crw,$crh);
imagejpeg($im,$res,$jpegqual);
imagedestroy($im);
break;
default:
CR_showUI();
exit;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// END OF STORY
?>