הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   פרסום | קיבוע לוגו על תמונה (https://hosts.co.il/forums/showthread.php?t=73873)

FuZuL 24-04-09 01:13

פרסום | קיבוע לוגו על תמונה
 
בעקבות מערכת שאני בונה חיפשתי סקריפט ברשת ולא מצאתי אחד שמאחד בין jpeg לpng,
לכן למען הדורות הבאים אני מפרסם אותו.

הסקריפט מקבע לוגו על קובץ, נבנה עבור מערכת העלאת קבצים.

PHP קוד:

<?php
$logo_file 
"logo.png";
$image_file "img.jpg";
$targetfile "img2.jpg";
$photo imagecreatefromjpeg($image_file);
$fotoW imagesx($photo);
$fotoH imagesy($photo);
$logoImage imagecreatefrompng($logo_file);
$logoW imagesx($logoImage);
$logoH imagesy($logoImage);
$photoFrame imagecreatetruecolor($fotoW,$fotoH);
$dest_x $fotoW $logoW;
$dest_y $fotoH $logoH;
imagecopyresampled($photoFrame$photo0000$fotoW$fotoH$fotoW$fotoH);
imagecopy($photoFrame$logoImage$dest_x$dest_y00$logoW$logoH);
imagejpeg($photoFrame$targetfile); 
echo 
'<img src="'.$targetfile.'" />';
/**
* By santin1991[at]gmail[dot]com
**/
?>

כדי לשים את הלוגו על הקובץ הקיים בלי ליצור עוד קובץ, פשוט להחליף את targetfile
PHP קוד:

$targetfile $image_file

המשך יום טוב.

snir. 24-04-09 10:01

תודה , חיפשתי הרבה זמן.
איפה מצאת בסוף ?

Roie885 25-04-09 15:19

תודה רבה

ofekbh 25-04-09 15:35

יפה תודה


כל הזמנים הם GMT +2. הזמן כעת הוא 14:26.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ