Oto skrypt:
<?php
Oto skrypt<span style="color: #007700":
[PHP]
if($ext == jpg || $ext == jpeg){
$logo_path = 'galeria/logo.png';
$logo_mini_path = 'galeria/logo2.png';
$img = imagecreatefromjpeg("galeria/".$userdata['username']."/galeria".$f."/zdjecie$i.$ext");
$width = imagesx($img);
$height = imagesy($img);
echo "<br/>$width : $height<br/>"; if($width > 1024 || $height > 1024){
if ($width > $height){
$x = 1024/$width;
$width_mini = $width * $x;
$height_mini = $height * $x;
echo "<br/>$width_mini : $height_mini<br/>"; $img_mini = imagecreatetruecolor($width_mini, $height_mini);
imagecopyresampled($img_mini, $img, 0, 0, 0, 0, $width_mini , $height_mini, $width , $height);
imagejpeg($img_mini, "galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_full.$ext", 80);
$logo_full = imagecreatefrompng( $logo_path );
$zdjecie_po = imagecreatefromjpeg("galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_full.$ext");
imagecopy($zdjecie_po, $logo_full, 80, 80, 0, 0, $width_mini , $height_mini);
imagejpeg($zdjecie_po, '', 80);
imagedestroy($img_mini);
$y = 100/$width;
$width_mini2 = $width * $y;
$height_mini2 = $height * $y;
echo "<br/>$width_mini2 : $height_mini2<br/>"; $img_mini2 = imagecreatetruecolor($width_mini2, $height_mini2);
imagecopyresampled($img_mini2, $img, 0, 0, 0, 0, $width_mini2 , $height_mini2, $width , $height);
imagejpeg($img_mini2, "galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_mini.$ext", 80);
$logo_mini = imagecreatefrompng( $logo_mini_path );
$zdjecie_po2 = imagecreatefromjpeg("galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_mini.$ext");
imagecopy($zdjecie_po2, $logo_mini, 15, 15, 0, 0, $width_mini2 , $height_mini2);
imagejpeg($zdjecie_po2, '', 80);
imagedestroy($img);
imagedestroy($img_mini2);
} else {
?>
W następnym poście cd...
Jeżeli któreś zmienne potrzebują objaśnienie to proszę pytać...
$userdata['username'] - trzyma nazwę użytkownika pobraną z phpbb
$f - kolejna liczba która ma zostać przypisana folderowi
CD.. skryptu
<?php
$x = (1024/$height);
$width_mini = $width * $x;
$height_mini = $height * $x;
$img_mini = imagecreatetruecolor($width_mini, $height_mini);
imagecopyresampled($img_mini, $img, 0, 0, 0, 0, $width_mini , $height_mini, $width , $height);
imagejpeg($img_mini, "galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_full.$ext", 80);
$logo_full = imagecreatefrompng( $logo_path );
$zdjecie_po = imagecreatefromjpeg("galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_full.$ext");
imagecopy($zdjecie_po, $logo_full, 80, 80, 0, 0, $width_mini , $height_mini);
imagejpeg($zdjecie_po, '', 80);
imagedestroy($img_mini);
$y = 100/$height;
$width_mini2 = $width * $y;
$height_mini2 = $height * $y;
echo "<br/>$width_mini2 : $height_mini2<br/>"; $img_mini2 = imagecreatetruecolor($width_mini2, $height_mini2);
imagecopyresampled($img_mini2, $img, 0, 0, 0, 0, $width_mini2 , $height_mini2, $width , $height);
imagejpeg($img_mini2, "galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_mini.$ext", 80);
$logo_mini = imagecreatefrompng( $logo_mini_path );
$zdjecie_po2 = imagecreatefromjpeg("galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_mini.$ext");
imagecopy($zdjecie_po2, $logo_mini, 15, 15, 0, 0, $width_mini2 , $height_mini2);
imagejpeg($zdjecie_po2, '', 80);
imagedestroy($img);
imagedestroy($img_mini2);
}
} else {
if ($width > $height){
$y = 100/$width;
$width_mini2 = $width * $y;
$height_mini2 = $height * $y;
echo "<br/>$width_mini2 : $height_mini2<br/>"; $img_mini2 = imagecreatetruecolor($width_mini2, $height_mini2);
imagecopyresampled($img_mini2, $img, 0, 0, 0, 0, $width_mini2 , $height_mini2, $width , $height);
imagejpeg($img_mini2, "galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_mini.$ext", 80);
$logo_mini = imagecreatefrompng( $logo_mini_path );
$zdjecie_po2 = imagecreatefromjpeg("galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_mini.$ext");
imagecopy($zdjecie_po2, $logo_mini, 15, 15, 0, 0, $width_mini2 , $height_mini2);
imagejpeg( $zdjecie_po2, '', 80);
imagedestroy($img);
imagedestroy($img_mini2);
} else {
?>
To jest tylko fragment odpowiedzialny za tworzenie i dodawanie loga...
<?php
$y = 100/$height;
$width_mini2 = $width * $y;
$height_mini2 = $height * $y;
echo "<br/>$width_mini2 : $height_mini2<br/>"; $img_mini2 = imagecreatetruecolor($width_mini2, $height_mini2);
imagecopyresampled($img_mini2, $img, 0, 0, 0, 0, $width_mini2 , $height_mini2, $width , $height);
imagejpeg($img_mini2, "galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_mini.$ext", 80);
$logo_mini = imagecreatefrompng( $logo_mini_path );
$zdjecie_po2 = imagecreatefromjpeg("galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_mini.$ext");
imagecopy($zdjecie_po2, $logo_mini, 15, 15, 0, 0, $width_mini2 , $height_mini2);
imagejpeg($zdjecie_po2, '', 80);
imagedestroy($img);
imagedestroy($img_mini2);
}
rename ("galeria/".$userdata['username']."/galeria".$f."/zdjecie$i.$ext", "galeria/".$userdata['username']."/galeria".$f."/$nazwa2"."_full.$ext"); }
?>
To już koniec... jeżeli ktoś chce zobaczyć cały to proszę powiedzieć to gdzieś go udostępnie...