çok sağolasın rvr yalnız bunu ufak bi uygulamayla göstersen onuda zipleyip koysan çokmu şey istemiş olurum tam olarak kavrayamadım php bilgim biraz zayıf ayrıca şöyle bi şey daha buldum biyerden alıntıdır
bunun için yazdığım bir fonksiyon vardı bi ara baya iş goruyor bir incele istersen
Kod:
##################################################3
function f_ApplyLogo2Img($SrcImg,$DstImg,$NewImgName=false) {
$src_system=explode(".",$SrcImg);
$dst_system=explode(".",$DstImg);
$src_system_type = $src_system[count($src_system)-1];
$dst_system_type = $dst_system[count($dst_system)-1];
header("Content-type: image/jpeg");
if (preg_match("/jpg|jpeg/",$dst_system_type)){
$dst_img=imagecreatefromjpeg($DstImg);
}
elseif (preg_match("/png/",$dst_system_type)){
$dst_img=imagecreatefrompng($DstImg);
}
if (preg_match("/jpg|jpeg/",$src_system_type)){
$src_img=imagecreatefromjpeg($SrcImg);
}
elseif (preg_match("/png/",$src_system_type)){
$src_img=imagecreatefrompng($SrcImg);
}
$src_x=imageSX($src_img);
$src_y=imageSY($src_img);
$dst_x=imageSX($dst_img);
$dst_y=imageSY($dst_img);
#imagecopyresampled($dst_img,$src_img,10,10,0,0,$dst_x,$dst_y,$src_x, $src_y);
if ($dst_x > $src_x || $dst_y > $src_y) {
$offset_x = ($dst_x/2)-($src_x/2);
$offset_y = ($dst_y/2)-($src_y/2);
}
else
{
$offset_x = 0;
$offset_y = 0;
}
imagecopymerge($dst_img,$src_img,$offset_x,$offset_y,0,0,$src_x,$src_ y,60);
if ($NewImgName) {
imagejpeg($dst_img,$NewImgName);
}
else
{
imagejpeg($dst_img);
}
imagedestroy($src_img);
imagedestroy($dst_img);
}
kullanım şu şekilde:
örneğin img.php diye bir dosya olsun sayfaya
Kod:
<img src="img.php" />
olarak ekleyeceksin.
img.php ise şöyle olmalı:
Kod:
<?php
require "function.php";
$resim = "images/resim.jpg";
$logo = "images/logo.jpg";
f_ApplyLogo2Img($logo,$resim); // bu şekilde yaparsan sadece resmi goterir
//f_ApplyLogo2Img($logo,$resim,"yeni_resim.jpg"); // boyle yaparsan resmi bir yere kaydeder (yeni_resim.jpg)
?>
NOT: function.php de ilgili fonskyonumuz olduğunu belirtmeme gerek yok sanırım
kolay gelsin