switch ($mimetype) { case 'image/jpg': case 'image/jpeg': $ext = "jpg"; break; case 'image/gif': $ext = "gif"; break; case 'image/png': $ext = "png"; break; } header("Content-Type: " . $mimetype); $cc = new canvasCrop(); //$cc->_showDebug = true; $cc->loadImage($src); $cc->cropToDimensions($sx, $sy, $ex, $ey); if ($title != "") { $cc->showText($title, $titlex, $titley, 1); } $cc->showImage($ext); $cc->flushImages(); /* $cc->loadImage('original2.png'); $cc->cropByPercent(15, 50, ccCENTER); $cc->saveImage('final2.jpg', 90); $cc->flushImages(); $cc->loadImage('original3.png'); //$cc->cropBySize($w, $h, ccBOTTOMRIGHT);
for ($y = 0; $y < imagesy($src); $y++) { $src_pix = imagecolorat($src, $x, $y); $src_pix_array = rgb_to_array($src_pix); if ($src_pix_array[0] < 100 && $src_pix_array[1] < 100 && $src_pix_array[2] < 100 && $started == 0) { $csx = $x; $csy = 0; $started = 1; $white = 0; } if ($src_pix_array[0] < 100 && $src_pix_array[1] < 100 && $src_pix_array[2] < 100) { $white = 0; } if ($started == 1 && $y == 19 && $white == 1) { $cey = 19; $cex = $x; $cc->loadImage('output.jpg'); $cc->cropToDimensions($csx, $csy, $cex, $cey); $cc->saveImage('ltr' . $ino . '.jpg'); $ino++; $started = 0; $csx . "," . $csy . "," . $cex . "," . $cey; "<br />"; } } $white = 1; } $srr = ''; for ($ino = 0; $ino < 6; $ino++) { $src = imagecreatefromJPEG('ltr' . $ino . '.jpg') or die('Problem with source'); $out = ImageCreateTrueColor(imagesx($src), imagesy($src)) or die('Problem In Creating image'); $string = '';