nie pomogło.. a co więcej zauważyłem że nawet gdy wysyłam znak wodny GET'em dodając do linku &znak=znaczek.jpg to też wyświetla się biała strona. Sprawdzałem na 2 serwerach, oba obsługują biblioteki GD.
OK, znalazłem coś takiego:
<?php
// This script will show image with logo on it
// Supported are PNGs,GIFs,JPEGs
// ------------------------------------------------------
// call it: <a href=\"http://www.domain.com/showimage.php?img=<name>\" target=\"_blank\">http://www.domain.com/showimage.php?img=<name></a>
// where <name> is name of image...
// example:
// <a href=\"http://www.domain.com/showimage.php?img=001.jpg\" target=\"_blank\">http://www.domain.com/showimage.php?img=001.jpg</a>
// ------------------------------------------------------
// You have to set parameters here:
// ------------------------------------------------------
$image_quality="80";
// quality of JPEG conpression [0-100]
// ------------------------------------------------------
$image_path="./images/";
// path to images
// examples:
// $image_path="./images/";
// $image_path="../../images/";
// ------------------------------------------------------
$logo_path="./logo.png";
// path and name of the LOGO image (PNG,GIF,JPEG)
// examples:
// $logo_path="./logos/img_logo.png";
// $logo_path="../../logos/img_logo.png"
// ------------------------------------------------------
$logo_pos_x="right";
// left, right, center
$logo_pos_y="bottom";
// top, middle, bottom
// ------------------------------------------------------
$error_not_found="Nie ma takiego obrazka";
// where image is not found, show this error text
$error_not_supported="This image type isn't supported";
// where image is not supported, show this error text
$error_bg_color=array(255
,255
,255
); // image background color in RGB - (RED,GREEN,BLUE)
$error_text_color=array(255
,0
,0
); // text color in RGB - (RED,GREEN,BLUE)
// ------------------------------------------------------
// YOU DON'T HAVE TO EDIT CODE BELOW THIS LINE
// ------------------------------------------------------
// SCRIPT written by Ladislav Soukup, [root@soundboss.cz]
// ------------------------------------------------------
function NewImage($width,$height,$text=""){
global $error_bg_color,$error_text_color; if (function_exists("imagecreatetruecolor")){
if (!@$img=imagecreatetruecolor($width,$height)){
$img=imagecreate($width,$height);
}
} else {
$img=imagecreate($width,$height);
}
$imgbgcolor=ImageColorAllocate($img,$error_bg_color[0],$error_bg_color[1],$error_bg_color[2]);
$imgtextcolor=ImageColorAllocate($img,$error_text_color[0],$error_text_color[1],$error_text_color[2]);
imagefilledrectangle($img,0,0,$width,$height,$imgbgcolor);
imagestring($img,5,10,10,$text,$imgtextcolor);
return($img);
}
Header("Content-type: image/jpeg"); $rep_from=array("./","../"); $_GET["img"]=str_replace($rep_from,$rep_to,$_GET["img"]); $file=$image_path . $_GET["img"];
$width=$info[0];
$height=$info[1];
if ($info[2]==1){
$img=@imagecreatefromgif($file);
} else if ($info[2]==2){
$img=@imagecreatefromjpeg($file);
} else if ($info[2]==3){
$img=@imagecreatefrompng($file);
} else {
$width=640;
$height=480;
$img=NewImage($width,$height,$error_not_supported);
}
} else {
$width=640;
$height=480;
$img=NewImage($width,$height,$error_not_found);
}
$logo_width=$info[0];
$logo_height=$info[1];
if ($info[2]==1){
$img_logo=imagecreatefromgif($logo_path);
} else if ($info[2]==2){
$img_logo=imagecreatefromjpeg($logo_path);
} else if ($info[2]==3){
$img_logo=imagecreatefrompng($logo_path);
} else {
$logo_width=120;
$logo_height=20;
$img=NewImage($logo_width,$logo_height,$error_not_supported);
}
// positioning - X
if ($logo_pos_x=="left"){
$dst_x=10;
} else if ($logo_pos_x=="center"){
$dst_x=round(($width-$logo_width)/2
); } else if ($logo_pos_x=="right"){
$dst_x=$width-10-$logo_width;
} else {
$dst_x=round(($width-$logo_width)/2
); }
// positioning - Y
if ($logo_pos_y=="top"){
$dst_y=5;
} else if ($logo_pos_y=="middle"){
$dst_y=round(($height-($logo_height/2
))/2
); } else if ($logo_pos_y=="bottom"){
$dst_y=$height-5-$logo_height;
} else {
$dst_y=round(($height-($logo_height/2
))/2
); }
imagecopy($img,$img_logo,$dst_x,$dst_y,0,0,$logo_width,$logo_height);
}
ImageJpeg($img,"",$image_quality);
?>
działa ok, ale czy jest możliwość przerobienia tego tak, by można było wyświetlać obrazki umieszczone na innych serwerach? Chodzi mi o coś takiego jak
http://stronajakas.pl/showimage.php?img=ht...ik.pl/fotka.jpgJest to wykonalne?
Edit: szukełem tego znak.php i znalazłem coś takiego:
http://siemensjava.pl/znak.php?obraz=http:....com/osbzub.pngWie ktoś może jak uzyskać taki efekt?
Ha, już prawie mam..
Na jakim¶ zagranicznym forum znalazłem:
<?php
// this script creates a watermarked image from an image file - can be a .jpg .gif or .png file
// where watermark.gif is a mostly transparent gif image with the watermark - goes in the same directory as this script
// where this script is named watermark.php
// call this script with an image tag
// <img src="watermark.php?path=imagepath"> where path is a relative path such as subdirectory/image.jpg
$imagesource = $_GET['path'];
if($filetype == ".gif") $image = @imagecreatefromgif($imagesource);
if($filetype == ".jpg") $image = @imagecreatefromjpeg($imagesource);
if($filetype == ".png") $image = @imagecreatefrompng($imagesource);
$watermark = @imagecreatefromgif('watermark.gif');
$imagewidth = imagesx($image);
$imageheight = imagesy($image);
$watermarkwidth = imagesx($watermark);
$watermarkheight = imagesy($watermark);
$startwidth = ((0) );
$startheight = (($imageheight - $watermarkheight) );
imagecopy($image, $watermark, $startwidth, $startheight, 0, 0, $watermarkwidth, $watermarkheight);
imagejpeg($image);
imagedestroy($image);
imagedestroy($watermark);
?>
Adres podajemy w taki sposób:
Kod
http://adresjaki¶.pl/obrazek.php?path=http://fotosik.pl/obrazek.jpg
Tyle że mam jeszcze 2 problemy:
1. Gdy jest to gif animowany tworzy się tylko 1 klatka, które jest nieruchoma.
2. Gdy klikam ppm/pokaż obrazek to wyskakuje co¶ w rodzaju:
Cytat
˙Ř˙ŕ�JFIF������˙ţ�>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ˙Ű�C� $.' ",#(7),01444'9=82<.342˙Ű�C 2!!22222222222222222222222222222222222222222222222222˙Ŕ��F,"�˙Ä����������� ˙Ä�µ���}�!1AQa"q2��ˇ#B±ÁRŃđ$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�����������������˘Ł¤Ą¦§¨©Ş˛ł´µ¶·¸ąşÂĂÄĹĆÇČÉĘŇÓÔŐÖ×ŘŮÚáâăäĺćçčéęńňóôőö÷řůú˙Ä�������� ˙Ä�µ��w�!1AQaq"2�B�ˇ±Á #3RđbrŃ $4á%ń&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz������������������˘Ł¤Ą¦§¨©Ş˛ł´µ¶·¸ąşÂĂÄĹĆÇČÉĘŇÓÔŐÖ×ŘŮÚâăäĺćçčéęňóôőö÷řůú˙Ú���?�·ŻëşĚ>%Ô �WżP·r��.\�»Č�đ*¬ëĚđŔ�ľ¤ŇĘÁxş|äţ?çůgř¦g�â%ČM��D�8 ĄĎĚO×ů~]�§Ľ7>Hş1ę[úcÓü�´±�S«�ú÷rˇ»¸fĆ8���<Őé®o��Ç�ů÷9%Ç ôŞ�ČĘKF0ËÎqŇ®4Kq�,����ą¨,˝-ĐýÓGu6Aňç ��P�|żé·HęĽć#qíŢł.ďî"�FÔ�r{�L׫ř�95Ytń.|ł�sß?Ď˙�Ĺ\�;ő®©),ÓLĹÎÖÂĘHÚ}zć¶�Ľ�2Ěü�ďW�XëIhʨx®»Lń%»(�ĎON TŁŘ�Ëą©©Z^Ną�ţh�ű.GňŞ�I«Yżďn�ć3ÔI#ó«�o±��{üÝ+ă\�fU¶ą,Ţ�xüé$ö*éj_şŐ.»#2p>`X�Xw×:�7�őćŢčen?Zصaw0�ŮKb®\ŮDčA^˘�d&Ű
Ma kto¶ jaki¶ pomysł jak to naprawić?