Je voudrais créer un filigrane avec PHP et la bibliothèque GD.Comment puis-je faire une image filigrane avec PHP et GD comme envato photodune preview image?
Je voudrais faire répéter le filigrane logo avec marge automatique (espace) entre chaque logo répété, également la position en zigzag.
Est-il possible de créer filigrane qui relie chaque logo de filigrane?
Le résultat serait comme suit:
j'ai achevé le zigzag à l'aide de la fonction de boucle et même clause impair.
/*
* utils
$widthWatermark = imagesx($logo);
$heightWatermark = imagesy($logo);
$widthPhoto = imagesx($output);
$heightPhoto = imagesy($output);
*/
// $xLogoPosition = 0;
// $yLogoPosition = 0;
$__xRepeat = ceil($widthPhoto/$widthWatermark);
$__yRepeat = ceil($heightPhoto/$heightWatermark);
$margin = (int)self::$option['margin'];
for ($i = 0; $i <= $__xRepeat; $i++) {
if ($i % 2 === 0) {
$pre_ii = 1;
} else {
$pre_ii = 0;
}
for ($ii = 0; $ii <= $__yRepeat; $ii++) {
$ii_zero = $ii - $pre_ii;
if ($ii_zero % 2 === 0) {
$y_xindent = $widthWatermark;
}else{
$y_xindent = 0;
}
$this->imagecopymerge_alpha($output, $logo, ($xLogoPosition + $widthWatermark * $i + $y_xindent), ($yLogoPosition + $widthWatermark * $ii), 0, 0, ImageSX($logo), ImageSY($logo), self::$option['opacity']);
}
}
maintenant je suis resté sur la façon de créer une ligne en pointillés qui ont une position diagonale qui se connectent à l'autre logo.
J'ai un soupçon de http://php.net/manual/en/function.imagedashedline.php mais je ne sais pas comment utiliser et de combiner avec mon code précédent qui génèrent logo zigzag
Montrez vos tentatives jusqu'à présent. – iplus26
Je peux juste commander la position répétée. bloqué sur la façon de le faire en zigzag – Suabahasa