|
|
PHP (angielski akronim rekurencyjny, którego rozwinięcie to PHP Hypertext Preprocessor), pierwotnie nazwany Personal
Home Page - skryptowy język programowania, służący przede wszystkim do tworzenia dynamicznych stron WWW i wykonywany w
tym przypadku po stronie serwera, z możliwością zagnieżdżania w HTML (bądź XHTML). PHP jest podobny w założeniach do
dużo starszego mechanizmu SSI (Server Side Includes), jednak jest w stosunku do SSI nieporównanie bardziej rozbudowany.
Udostępniany jest na zasadach licencji open-source. Jego składnia bazuje na językach C, Java i Perl.
SQL (ang. Structured Query Language) to strukturalny język zapytań używany do tworzenia, modyfikowania baz danych oraz
do umieszczania i pobierania danych z baz danych.
Język SQL jest językiem deklaratywnym. Decyzję o sposobie przechowywania i pobrania danych pozostawia się systemowi
zarządzania bazą danych DBMS.
Jest to język programowania opracowany w latach siedemdziesiątych w firmie IBM. Stał się on standardem w komunikacji z
serwerami relacyjnych baz danych. Wiele współczesnych systemów relacyjnych baz danych używa do komunikacji z
użytkownikiem SQL, dlatego mówi się, że korzystanie z relacyjnych baz danych, to korzystanie z SQL-a.
Apache jest otwartym serwerem HTTP dostępnym dla wielu systemów operacyjnych (m.in. UNIX, GNU/Linux, BSD,
Microsoft Windows). Po angielsku słowo Apache wymawia się epaczi, co brzmi tak samo jak a patchy (server), co było
określeniem tego serwera we wczesnym stadium jego rozwoju w 1995 roku, kiedy był on głównie zbiorem poprawek (patch)
nałożonych na serwer HTTP o nazwie NCSA.
Apache jest najszerzej stosowanym serwerem HTTP w Internecie. W maju 2003 jego udział wśród serwerów wynosił 62%. W
połączeniu z interpreterem języka skryptowego PHP i bazą danych MySQL, Apache stanowi jedno z najczęściej spotykanych
środowisk w firmach oferujących miejsce na serwerach sieciowych.
|
imagecopyresampled
(PHP 4 >= 4.0.6, PHP 5) imagecopyresampled -- Copy and
resize part of an image with resampling
Descriptionbool imagecopyresampled ( resource dst_image,
resource src_image, int dst_x, int dst_y, int src_x, int src_y,
int dst_w, int dst_h, int src_w, int src_h )
imagecopyresampled() copies a
rectangular portion of one image to another image, smoothly
interpolating pixel values so that, in particular, reducing the
size of an image still retains a great deal of clarity. Zwraca
TRUE w przypadku sukcesu,
FALSE w przypadku porażki.
dst_image is the destination
image, src_image is the source
image identifier. If the source and destination coordinates and
width and heights differ, appropriate stretching or shrinking
of the image fragment will be performed. The coordinates refer
to the upper left corner. This function can be used to copy
regions within the same image (if dst_image is the same as src_image) but if the regions overlap the
results will be unpredictable.
Notatka: There is a problem due to palette image
limitations (255+1 colors). Resampling or filtering an
image commonly needs more colors than 255, a kind of
approximation is used to calculate the new resampled pixel
and its color. With a palette image we try to allocate a
new color, if that failed, we choose the closest (in
theory) computed color. This is not always the closest
visual color. That may produce a weird result, like blank
(or visually blank) images. To skip this problem, please
use a truecolor image as a destination image, such as one
created by imagecreatetruecolor().
Notatka: Fa funkcja wymaga GD 2.0.1 lub
nowszego.
Przykłady
Przykład 1. Simple example
This example will resample an image to half its
original size.
<?php // The file $filename = 'test.jpg';
$percent = 0.5;
// Content type header('Content-type: image/jpeg');
// Get new dimensions list($width, $height) = getimagesize($filename);
$new_width = $width * $percent; $new_height = $height * $percent;
// Resample $image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output imagejpeg($image_p, null, 100); ?> |
|
Przykład 2. Resampling an image
proportionally
This example will display an image with the maximum
width, or height, of 200 pixels.
<?php // The file $filename = 'test.jpg';
// Set a maximum height and width
$width = 200; $height = 200;
// Content type header('Content-type: image/jpeg');
// Get new dimensions list($width_orig, $height_orig) = getimagesize($filename);
if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
// Resample $image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output imagejpeg($image_p, null, 100); ?> |
|
|