Jump to content

Yasoymama

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Yasoymama's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am not a PHP expert, so I don't exactly know what the problem with these scripts. I configure the file config. inc. php, and that is suppossed to be the the only one to be customized. The rest of the script are files that don't have to be moddified. When I enter to my index.php page, and I try to load background (the first thing you have to do), the page reloads but no image loads. So the the application stops in that point. This is mycanvas home page: http://allayers.com/mycanvas/ And this is mine one: http://www.yasoymama.com/mycanvas/ As you can see, something is wrong, and I can't solve the problem
  2. The files I included before belong to this application... if anyone can take a look at them... do you think it is possible to make it work or should I forget about it?
  3. maxudaskin, I made what you said and all notices dissapear. I'm trying to run on my web this application made in PHP: http://allayers.com/mycanvas/ It would be perfect for my site, with some modifications, but as I know there are problems when running under PHP5, although it is supposed to be fixed in the last version. The download page of last version is http://truecolor.allayers.com/, if anyone could make it work on PHP 5...
  4. OK. Good answer, must be mor pacient I suppose... I have been looking on the net what those notices are. And as you say, not errors. I will wait for something that can help me
  5. Thanks a lot, Christian F. AbraCadaver, I did what you said and these are the errors: Notice: Undefined variable: img_dir in xxx/index.php on line 7 Notice: Undefined variable: uploadedfile in xxx/index.php on line 9 Notice: Undefined variable: backgroundcolor in xxx/index.php on line 18 Notice: Undefined variable: backgroundimage in xxx/index.php on line 21 Notice: Undefined variable: currentimage in xxx/index.php on line 23 Notice: Undefined variable: info in xxx/index.php on line 76 Notice: Undefined variable: info in xxx/index.php on line 82 Notice: Undefined variable: info in xxx/index.php on line 89 Notice: Undefined variable: info in xxx/index.php on line 95 Voeg plaatje in... Notice: Undefined variable: info in xxx/index.php on line 102 Notice: Undefined variable: info in xxx/index.php on line 108 I have configured config.ini.php with the root to every directory. <? // image subdir for standard backgrounds DEFINE("IMG_DIR","backgrounds/"); // result images - must be writable! DEFINE("RES_DIR","images/"); // to merge/upload - must be writable! DEFINE("MRG_DIR","merge/"); // select merge dialogs etc. - readonly DEFINE("SEL_DIR","select/"); // truetype font files - readonly DEFINE("FNT_DIR","ttf/"); // maximum age of result (temp) images DEFINE("MAXAGE",3); // default language DEFINE("LANGUAGE","en"); // default filetype to produce jpg or png DEFINE("OUTPUT","jpg"); // default positions for images on screen in pixels // background $image_default_x = 150; $image_default_y = 150; // dropin image $merge_default_x = 200; $merge_default_y = 200; // text preview $text_default_x = 220; $text_default_y = 230; // max script exec time, when needed decomment //set_time_limit(50); // memory limit, php default is 8 MB. raising it will permit larger images ini_set("memory_limit", "16M"); ?> And this is index.php <? include("include/config.inc.php"); include("language/lang.".LANGUAGE.".php"); include("include/image.class.php"); include("include/functions.php"); if (!$img_dir) $img_dir = IMG_DIR; if ($uploadedfile){ if (copy($uploadedfile,MRG_DIR.$uploadedfile_name)) $mergefile = MRG_DIR.$uploadedfile_name; $mergefilename = $uploadedfile_name; $merge = new imageobject(MRG_DIR,$uploadedfile_name); } if ($backgroundcolor && $width && $height){ $new = new imageobject(IMG_DIR,"",$width,$height,$backgroundcolor); if ($new->newobj) $info = $new->newobj; } elseif ($backgroundimage){ $info = new imageobject(IMG_DIR,$backgroundimage); } elseif ($currentimage){ $img = splitDirFile($currentimage); $info = new imageobject($img[0], $img[1]); if ($mailto) include("include/mailimage.php"); else{ if ($placedmerge && !$uploadedfile){ $mrg = splitDirFile($placedmerge); $offx = $xmerge - $ximg; $offy = $ymerge - $yimg; $info = $info->mergeImage($mrg[0],$mrg[1],$mergewidth,$mergeheight,$offx,$offy); unset($placedmerge); } if ($textstring){ if (!$currentlabel)$currentlabel = $currentimage; $offx = $textxpos - $ximg; $offy = $textypos - $yimg; $info = $info->writeText($currentlabel, $offx, $offy, $textstring, $fontsize, $truetype, $fontcolor, $fontangle); } }// mailto else }else{ deleteOldFiles(); } ?> <html> <head> <title><?=TITLE?></title> <? include("include/dragdrop.js.php"); include("templates/style.css.php"); ?> <body onload="libinit();"> <table width="100%" class="white" cellspacing="2" cellpadding="2"> <tr> <td width="28" nowrap align="center"> <A href="#" onclick="objopen.showIt()"> <img src="templates/images/color.gif" border="0"> </A> </td> <td> <A href="#" onclick="objopen.showIt()"> <?=LANG_CHOOSE?> </A> </td> <td width="28" nowrap align="center" border="0"> <? if ($info){ ?> <A href="#" onclick="objtext.showIt()"><?}else{?><A href="#" onclick="alert('<?=LANG_FIRST?>')"><?}?> <img src="templates/images/font.gif" border="0"> </A> </td> <td> <? if ($info){ ?> <A href="#" onclick="objtext.showIt()"><?}else{?><A href="#" onclick="alert('<?=LANG_FIRST?>')"><?}?> <?=LANG_ADDTEXT?> </A> </td> <td width="28" nowrap align="center"> <? if ($info){ ?> <A href="#" onclick="objupload.showIt()"><?}else{?><A href="#" onclick="alert('<?=LANG_FIRST?>')"><?}?> <img src="templates/images/merge.gif" border="0"> </A> </td> <td> <? if ($info){ ?> <A href="#" onclick="objupload.showIt()"><?}else{?><A href="#" onclick="alert('<?=LANG_FIRST?>')"><?}?> <?=LANG_UPLOADLOGO?> </A> </td> <td width="28" nowrap align="center"> <? if ($info){ ?> <A href="#" onclick="objfinish.showIt()"><?}else{?><A href="#" onclick="alert('<?=LANG_FIRST?>')"><?}?> <img src="templates/images/save.gif" border="0"> </A> </td> <td> <? if ($info){ ?> <A href="#" onclick="objfinish.showIt()"><?}else{?><A href="#" onclick="alert('<?=LANG_FIRST?>')"><?}?> <?=LANG_FINISHED?> </A> </td> <td>TrueColor MyCanvas<BR/><A href="http://allayers.com">© ALLAYERS.COM</A></td> </tr> </table> <? include("templates/dialogs.dhtml.php"); ?> <?if($message) echo "<div align=\"center\">$message</div>"; ?> <div id="previewdiv" onclick="setTextPreviewXY()"> <img name="previewimage" id="previewimage"> </div> <div id="lefttopdiv" onclick="showResize()"> </div> <div id="rightbottomdiv" onclick="showResize()"> </div> <div id="imgdiv" onclick="setImagePos()"> <IMG id="mainimg"<? if ($info) echo " src=\"".$info->directory.$info->filename."\" ".$info->string; ?>> </div> <div id="mergediv" onmousemove="setMergePos()"> <IMG id="mergeimg"<? if ($mergefile) echo " src=\"".$mergefile."\""; ?>> </div> </body> </html>
  6. I have the same problem, but I can't make it work! I have little knowledge about PHP, so any help would be great for me... This is my image.class.php: class imageobject{ var $handle; var $type="png"; var $height=0; var $width=0; var $string;// for img height/width tags var $square; // output message var $message; // previous file var $previous; // current var $directory; var $filename; //output var $resample = false; var $quality="80"; var $output=OUTPUT;// alternatives are png8 or png var $transparent; // only if output=png8 // textobject var $previewobject; // option var $savefile = true; // var $newobj; //constructor function imageobject($directory,$filename,$width=0,$height=0,$color="FFFFFF") { $this->directory = $directory; $this->filename = $filename; if ($filename=="" && $width>0 && $height>0){ $new = $this->createImage($width,$height); $col = ImageColorAllocate($new, hexdec(substr($color,0,2)), hexdec(substr($color,2,2)),hexdec(substr($color,4,2))); ImageFilledRectangle($new,0,0,$width,$height,$col); $this->newobj = $this->createUnique($new); }elseif (file_exists($directory.$filename)){ $this->filesize = ceil(filesize($directory.$filename)/1024); $size = GetImageSize($directory.$filename); if ($size) $this->handle = $this->getHandle($directory.$filename,$size[2]); $this->width = $size[0]; $this->height = $size[1]; $this->string = $size[3]; $this->square = $size[0]*$size[1]; if ($this->handle) $this->message = $GLOBALS["message_supported"]; else $this->message = $GLOBALS["message_not_supported"]; } }// constructor // private methods function getHandle($name,&$type) { switch ($type){ case 1: $im = imagecreatefromgif($name); $this->type= "gif"; break; case 2: $im = imagecreatefromjpeg($name); break; case 3: $im = imagecreatefrompng($name); $this->type= "png"; break; } return $im; } function saveAlpha(&$handle) { ImageAlphaBlending($handle, true); imagesavealpha($handle,false); imagesavealpha($handle,true); } function getHexColor($xpos,$ypos) { $color = imagecolorat($this->handle, $xpos, $ypos); $colorrgb = imagecolorsforindex($this->handle,$color); if ($colorrgb["red"]>0)$hred = dechex($colorrgb["red"]); else $hred = "00"; if (strlen($hred)<2)$hred = "0".$hred; if ($colorrgb["green"]>0)$hgreen = dechex($colorrgb["green"]); else $hgreen = "00"; if (strlen($hgreen)<2)$hgreen = "0".$hgreen; if ($colorrgb["blue"]>0)$hblue = dechex($colorrgb["blue"]); else $hblue = "00"; if (strlen($hblue)<2)$hblue = "0".$hblue; return strtoupper($hred.$hgreen.$hblue); } function uniqueName() { $add=""; $fileparts = split("\.",$this->filename); $nonchr = array("__","0","1","2","3","4","5","6","7","8","9"); $desc = str_replace($nonchr,"",$fileparts[0]); $name = $desc."__".date("YmdHms"); // if exists add incremented number if (file_exists($this->directory.$name.".".$this->type)){ $add = 1; while(file_exists($this->directory.$name.$add.".".$this->type)) $add++; } return $imgnew.$name.$add.".".$this->type; } function createUnique($imgnew) { $this->type = substr($this->output,0,3); $unique_str = $this->uniqueName(); switch ($this->type){ case "png": imagepng($imgnew,RES_DIR.$unique_str); break; default: imagejpeg($imgnew,RES_DIR.$unique_str,$this->quality); break; } $this->handle && imagedestroy($this->handle); $newobject = new imageobject(RES_DIR,$unique_str,$this->type); return $newobject; } function createImage($new_w,$new_h) { if (function_exists("imagecreatetruecolor") && $this->output!="png8"){ return imagecreatetruecolor($new_w,$new_h); }else{ return imagecreate($new_w,$new_h); } } function copyhandle(&$dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) { if ($this->output=="png8" && $this->type="jpg"){ imagecopyresized($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); $this->resample==true; } if (function_exists("imagecopyresampled") && $this->resample==true) imagecopyresampled($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); else imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); } function copycreatehandle(&$src_im, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) { $dst_im = $this->createImage($dst_w,$dst_h); $this->copyhandle($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); return $dst_im; } // public methods function resizeImage($scale,$newwidth=0,$newheight=0) { $new_w = $this->width; $new_h = $this->height; $aspect_ratio = (int) $new_h / $new_w; if ($scale) $new_w = $new_w * $scale; if ($newwidth>0) $new_w = $newwidth; if ($newheight>0){ $new_h = $newheight; $new_w = (int) $new_h / $aspect_ratio; }else{ $new_h = abs($new_w * $aspect_ratio); } $dst_img = $this->copycreatehandle($this->handle, 0, 0, 0, 0, $new_w, $new_h, $this->width,$this->height); return $this->createUnique($dst_img); } function cropImage($top,$right,$bottom,$left) { $new_w = $right - $left; $new_h = $bottom - $top; $dst_img = $this->copycreatehandle($this->handle, 0, 0, $left, $top, $new_w, $new_h, $new_w, $new_h); return $this->createUnique($dst_img); } function writeText($label, $xpos=0, $ypos=0, $textstring, $fontsize, $truetype, $fontcolor="FFFFFF",$fontangle) { $fontbgcolor= $this->getHexColor($xpos,$ypos); $textimage = new imagetext($truetype,$fontsize,$fontcolor,$textstring,$fontbgcolor,$fontangle); ImageAlphaBlending($this->handle, true); imagesavealpha($this->handle,false); imagesavealpha($this->handle,true); $this->copyhandle($this->handle, $textimage->handle, $xpos, $ypos, 0, 0, $textimage->dx, $textimage->dy,$textimage->dx, $textimage->dy); return $this->createUnique($this->handle); } function mergeImage($dir,$placedfile,$mergewidth,$mergeheight,$offx,$offy,$transcolor="") { $source = new imageobject($dir,$placedfile); $source->saveAlpha($source->handle); if ($transcolor){ $r = hexdec(substr($transcolor, 0, 2)); $g = hexdec(substr($transcolor, 2, 2)); $b = hexdec(substr($transcolor, 4, 2)); $color = imagecolorallocate($source->handle, $r, $g, $b); imagecolortransparent($source->handle,$color); } $this->saveAlpha($this->handle); ImageCopyResized($this->handle, $source->handle,$offx,$offy,0,0,$mergewidth,$mergeheight,$source->width,$source->height); return $this->createUnique($this->handle); } }// class I tried to change $this with $thisio, as AbraCadaver said, but I am not able to make the script run. Any help?
  7. Hello! I'd like to have the fully working version. I have the same problem than both of you...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.