try in png
This commit is contained in:
parent
35d62f4f6c
commit
dd0b843f38
1 changed files with 18 additions and 18 deletions
|
|
@ -14,8 +14,8 @@ trait GenerateBR {
|
|||
$arial = public_path().'/generation/src/arial.ttf';
|
||||
$arialbd = public_path().'/generation/src/arialbd.ttf';
|
||||
$impact = public_path().'/generation/src/impact.ttf';
|
||||
$hand_picture = 'generation/src/hand.jpg';
|
||||
$mask_img = 'generation/src/mask.jpg';
|
||||
$hand_picture = 'generation/src/hand.png';
|
||||
$mask_img = 'generation/src/mask.png';
|
||||
|
||||
if(null !== $request->input('site_id')){
|
||||
$site = Site::where(['id' => $request->input('site_id')])->first();
|
||||
|
|
@ -27,7 +27,7 @@ trait GenerateBR {
|
|||
|
||||
$product_image = $coupon->coupon_decoration_image;
|
||||
// ---- Masque dans lequel l'image finale sera placée
|
||||
$mask = imagecreatefromjpeg($mask_img);
|
||||
$mask = imagecreatefrompng($mask_img);
|
||||
list($maskWidth, $maskHeight) = getimagesize($mask_img);
|
||||
|
||||
// ---- Contact distributeur
|
||||
|
|
@ -51,7 +51,7 @@ trait GenerateBR {
|
|||
imagecopy($mask, $ImageMentionFond, 335, 235, 0, 0, imagesx($ImageMentionFond), imagesy($ImageMentionFond));
|
||||
|
||||
// ---- Copie la main dans le mask
|
||||
$hand = imagecreatefromjpeg($hand_picture);
|
||||
$hand = imagecreatefrompng($hand_picture);
|
||||
imagecopy($mask, $hand, 577, 2, 0, 0, imagesx($hand), imagesy($hand));
|
||||
imagealphablending( $mask, false );
|
||||
imagesavealpha( $mask, true );
|
||||
|
|
@ -100,27 +100,27 @@ trait GenerateBR {
|
|||
imagecolortransparent($ImageFond, $white);
|
||||
imagecopy($mask, $ImageFond, 360, 170, 0, 0, imagesx($ImageFond), imagesy($ImageFond));
|
||||
|
||||
// ---- Copie le produit dans le mask
|
||||
$pdt = imagecreatefromjpeg($product_image);
|
||||
imagecopy($mask, $pdt, 45, 26, 0, 0, imagesx($pdt), imagesy($pdt));
|
||||
imagealphablending( $mask, false );
|
||||
imagesavealpha( $mask, true );
|
||||
// // ---- Copie le produit dans le mask
|
||||
// $pdt = imagecreatefromjpeg($product_image);
|
||||
// imagecopy($mask, $pdt, 45, 26, 0, 0, imagesx($pdt), imagesy($pdt));
|
||||
// imagealphablending( $mask, false );
|
||||
// imagesavealpha( $mask, true );
|
||||
|
||||
// ---- Copie le logo dans le mask
|
||||
$logo = imagecreatefromjpeg($logo_display);
|
||||
imagecopy($mask, $logo, 767, 220, 0, 0, imagesx($logo), imagesy($logo));
|
||||
imagealphablending( $mask, false );
|
||||
imagesavealpha( $mask, true );
|
||||
// // ---- Copie le logo dans le mask
|
||||
// $logo = imagecreatefromjpeg($logo_display);
|
||||
// imagecopy($mask, $logo, 767, 220, 0, 0, imagesx($logo), imagesy($logo));
|
||||
// imagealphablending( $mask, false );
|
||||
// imagesavealpha( $mask, true );
|
||||
|
||||
// ---- Créer le fichier final
|
||||
imagejpeg($mask, public_path('generation')."/".$coupon->coupon_code.".jpg", 100);
|
||||
imagepng($mask, public_path('generation')."/".$coupon->coupon_code.".png", 9);
|
||||
|
||||
// ---- Libère la mémoire associée aux images manipulées
|
||||
imagedestroy($logo);
|
||||
imagedestroy($pdt);
|
||||
//imagedestroy($logo);
|
||||
//imagedestroy($pdt);
|
||||
imagedestroy($mask);
|
||||
|
||||
return "generation/".$coupon->coupon_code.".jpg";
|
||||
return "generation/".$coupon->coupon_code.".png";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue