$img->save('../loadimg/' . $result_filename); } else { $pozX = $posx; $pozY = $posy; $marX = $wmpadx; $marY = $wmpady; $widMain = $imagewidth; $heigMain = $imageheight; $widWat = $wtwidth; $heigWat = $wtheight; $img = new SimpleImage($img_main_path); $newPozX = $pozX; while ($newPozX < $widMain) { $newPozY = $pozY; while ($newPozY < $heigMain) { $img->overlay($img_watmark_path, 'top left', $opacity, $newPozX, $newPozY); $newPozY += $heigWat + $marX; } $newPozX += $widWat + $marY; } $img->save('../loadimg/' . $result_filename); } $uploadpath = "../loadimg/result.jpg"; exit($uploadpath); /*$answer['1'] = $$img_watmark_path; $answer['2'] = $imageheight; $answer['3'] = $wtwidth; $answer['4'] = $wtheight; $answer['pathimg'] = $img_main_path;
if(strlen($texto) > 100){ if(strlen($texto) > 150){ $y = 10; } else{ $y = 2; } } else { $y = 1; } foreach ($a_texto as $txt) { if(strlen($txt)+strlen($tmp_text) < 35) { $tmp_text .= ' '.$txt; } else{ $image->text($tmp_text, 'font.ttf', 15, '#4D4D4D', 'center', 200, $y); $y=$y+35; $tmp_text = $txt; //$image->text($txt, 'font.ttf', 20, '#4D4D4D', 'center', 0, $y); } } if($texto <= 35) { $image->text($tmp_text, 'font.ttf', 15, '#4D4D4D', 'center', 200, $y); } */ $image->overlay('uploads/tmp_' . $archivo, 'center center', 1, 20, 0); echo $file_name = rand(0, 10000) . '-' . rand(0, 10000) . '-' . rand(0, 10000) . '.jpg'; $image->save('posts/' . $file_name);
public function overlay($overlay, $position = 'center', $opacity = 1, $x_offset = 0, $y_offset = 0) { $this->image_class->overlay($overlay, $position, $opacity, $x_offset, $y_offset); return $this; }
$img->save('./file/watermarked.jpg'); } else { if ($mode == "tile") { $pozX = $originX; $pozY = $originY; $marX = $marginX; $marY = $marginY; $widMain = $imagewidth; $heigMain = $imageheight; $widWat = $wtwidth; $heigWat = $wtheight; $img = new SimpleImage($uploadfile); $newPozX = $pozX; while ($newPozX < $widMain) { $newPozY = $pozY; while ($newPozY < $heigMain) { $img->overlay($watermarkfile, 'top left', $opacity, $newPozX, $newPozY); $newPozY += $heigWat + $marX; } $newPozX += $widWat + $marY; } $img->save('./file/watermarked.jpg'); } } } // else { // echo "<h3>Ошибка! Не удалось загрузить файл на сервер!</h3>"; // exit; // } header("Content-Type: application/json"); echo json_encode($answer);