Function.imagecreatefromgd2part
Aus PHP-Wiki
imagecreatefromgd2part — Create a new image from a given part of GD2 file or URL
Inhaltsverzeichnis |
Beschreibung
resource imagecreatefromgd2part ( string $filename , int $srcX , int $srcY , int $width , int $height )
Create a new image from a given part of GD2 file or URL.
TippMit dieser Funktion können Sie eine
URL als Dateinamen verwenden, falls Sie
fopen wrappers ermöglicht haben. Mehr Details dazu, wie Sie den
Dateinamen angeben müssen finden Sie bei fopen(). Eine
Liste der unterstützten URL Protokolle finden Sie unter
List of Supported Protocols/Wrappers.
Parameter-Liste
- filename
- Path to the GD2 image.
- srcX
- x-coordinate of source point.
- srcY
- y-coordinate of source point.
- width
- Source width.
- height
- Source height.
Rückgabewerte
Returns an image resource identifier on success, FALSE on errors.
Beispiele
Beispiel #1 imagecreatefromgd2part() example
<?php // For this example we need the image size before // we create the image instance $image = getimagesize('./test.gd2'); // Create the image instance now we got the image // sizes $im = imagecreatefromgd2part('./test.gd2', 4, 4, ($image[0] / 2) - 6, ($image[1] / 2) - 6); // Do an image operation, in this case we emboss the // image if PHP5+ if(function_exists('imagefilter')) { imagefilter($im, IMG_FILTER_EMBOSS); } // Save optimized image imagegd2($im, './test_emboss.gd2'); imagedestroy($im); ?>
Anmerkungen
Hinweis: Diese Funktion setzt die GD Bibliothek in der Version 2.0.1 oder höher (empfohlen wird mindestens 2.0.28) voraus. WarnungPHP Versionen kleiner 4.3.0 für Windows, erlauben den Zugriff auf Remote-Dateien mit dieser Funktion nicht, selbst wenn allow_url_fopen aktiviert ist.