(PHP 4 >= 4.0.7, PHP 5, PHP 7, PHP 8)
imagecreatefromgd2part — Create a new image from a given part of GD2 file or URL
$filename,$x,$y,$width,$heightCreate a new image from a given part of GD2 file or URL.
È possibile utilizzare un URL come nome di file con questa funzione se i fopen wrapper sono stati abilitati. Vedere fopen() per maggiori dettagli su come specificare il nome del file. Vedere Protocolli e Wrapper supportati per i link alle informazioni sulle capacità dei vari wrapper, note sul loro uso e informazioni sulle eventuali variabili predefinite che forniscono.
filenamePath to the GD2 image.
xx-coordinate of source point.
yy-coordinate of source point.
widthLarghezza dell'originale.
heightAltezza dell'originale.
Restituisce un oggetto immagine in caso di successo, false in caso di errore.
| Versione | Descrizione |
|---|---|
| 8.0.0 | On success, this function returns a GDImage instance now; previously, a resource was returned. |
Example #1 imagecreatefromgd2part() example
<?php
// For this example we need the image size before
$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(function_exists('imagefilter'))
{
imagefilter($im, IMG_FILTER_EMBOSS);
}
// Save optimized image
imagegd2($im, './test_emboss.gd2');
?>I formati di immagine GD e GD2 sono formati di immagine proprietari di libgd. Devono essere considerati obsoleti, e dovrebbero essere usati solo a scopo di sviluppo e test.