$DARKNESS); // imagefilledrectangle($img,$x1,$y1,$x2,$y2,$dark); // () $white=imagecolorallocate($img,255,255,255); // (- ;) ) $x=55; $y=10; // imagestring($img,1,$x,$y,"snippets.pp.ru",$white); // imagepng($img); imagedestroy($img); /* http://www.codenet.ru/webmast/php/gd/Rectangle.php */ ?> //////////////////////////////// function img_resize($src, $out, $width, $height, $color = 0xFFFFFF, $quality = 100) { // if (!file_exists($src)) { return false; } $size = getimagesize($src); $format = strtolower(substr($size['mime'], strpos($size['mime'], '/') + 1)); $picfunc = 'imagecreatefrom'.$format; $gor = $width / $size[0]; // $ver = $height / $size[1]; // , , if ($height == 0) { $ver = $gor; $height = $ver * $size[1]; } // elseif ($width == 0) { $gor = $ver; $width = $gor * $size[0];} // $ratio = min($gor, $ver); // if ($gor == $ratio) $use_gor = true; else $use_gor = false $new_width = $use_gor ? $width : floor($size[0] * $ratio); $new_height = !$use_gor ? $height : floor($size[1] * $ratio); $new_left = $use_gor ? 0 : floor(($width - $new_width) / 2); $new_top = !$use_gor ? 0 : floor(($height - $new_height) / 2); $picsrc = $picfunc($src); // $picout = imagecreatetruecolor($width, $height); // imagefill($picout, 0, 0, $color); // imagecopyresampled($picout, $picsrc, $new_left, $new_top, 0, 0, $new_width, $new_height, $size[0], $size[1]); // imagejpeg($picout, $out, $quality); // imagedestroy($picsrc); imagedestroy($picout); return true; } ---------------------------------------------------- function smiles($body) { $op=file('sm.txt'); foreach ($op as $k=>$v) { $v=trim($v); if (empty($v)){} else { $mystring=$body; $search='&lt;'.$k.'&gt;'; $pos=strpos($mystring,$search); $len=strlen($search); if ($pos===false){} else { $body=substr_replace($body,'<img src="s/'.$k.'.gif" alt="'.$v.'">',$pos,$len); return $body; } } } return $body; } -------------------------------------------------- $file='images.gif'; $path=pathinfo($file); echo $path['extension']; // gif --------------------------------------------- php , /: <?php # 1: $myvar = 'test'; $content = '!'; $$myvar = $content; echo $test; //: ! ?> . : <?php # 2: $imagestypes = array('png'
назад далее
перейти
в начало
В библиотеку

на главную



..
(c) xika.ru