chdir("../");
include "modules/session.php";
if(!empty($_FILES['file'])){
if(empty($_FILES['file']['error'])){
if(!empty($_POST['g-recaptcha-response'])){
//your site secret key
$secret = '6LdWKmkUAAAAAMLfO1cTTUzRoh_3vuu_uiRz-bur';
//get verify response data
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
$responseData = json_decode($verifyResponse);
if($responseData->success){
$recaptcha = true;
}
}
if(!empty($recaptcha)){
$success = true;
chdir("seamless-converter/");
$target_dir = "uploaded/".time()."/";
mkdir($target_dir);
$target_name = basename($_FILES["file"]["name"]);
move_uploaded_file($_FILES["file"]["tmp_name"], $target_dir.$target_name);
// $src = new Imagick($_FILES['file']['tmp_name']);
$src = new Imagick($target_dir.$target_name);
/* clone to show input */
$input = clone $src;
/* resize texture as square */
$vmin = min($src->getImageWidth(),$src->getImageHeight());
$src->cropImage($vmin,$vmin,0,0);
$output1 = applySeamlessFilter($src, "seamless0.psd");
$output2 = applySeamlessFilter($src, "seamless1.psd");
$output3 = applySeamlessFilter($src, "seamless2.psd");
$output1->writeImage($target_dir."output1.jpg");
$output2->writeImage($target_dir."output2.jpg");
$output3->writeImage($target_dir."output3.jpg");
chdir("../");
} else {
$_SESSION["popupMessage"] = "Please, click on reCAPTCHA button!";
}
}
}
function applySeamlessFilter($src, $filterName){
$offset = clone $src;
$output = clone $src;
$width = $offset->getImageWidth();
/* offset background */
$output->rollImage($width/2,$width/2);
/* load and resize filter */
$seamlessFilter = new Imagick($filterName);
$seamlessFilter->resizeImage($width,$width,Imagick::FILTER_LANCZOS,1);
/* use filter on source */
$offset->setImageFormat("png");
$offset->compositeImage($seamlessFilter, Imagick::COMPOSITE_COPYOPACITY, 0, 0);
/* composite offset and source */
$output->compositeImage($offset, Imagick::COMPOSITE_OVER, 0, 0);
$output->setImageFormat("jpg");
return $output;
}
?>
Warning: include(modules/header.php): Failed to open stream: No such file or directory in
/web/htdocs/www.the3rdsequence.com/home/texturedb/seamless-converter/index.php on line
85
Warning: include(): Failed opening 'modules/header.php' for inclusion (include_path='.:/php8.1/lib/php') in
/web/htdocs/www.the3rdsequence.com/home/texturedb/seamless-converter/index.php on line
85