imagesx

(PHP 4, PHP 5, PHP 7, PHP 8)

imagesxGörüntünün genişliğini döndürür

Açıklama

imagesx(GdImage $görüntü): int

Belirtilen görüntünün genişliğini döndürür

Bağımsız Değişkenler

görüntü

imagecreatetruecolor() gibi bir görüntü oluşturma işlevinden dönen bir GdImage nesnesi.

Dönen Değerler

görüntünün genişliğini döndürür.

Sürüm Bilgisi

Sürüm: Açıklama
8.0.0 görüntü bağımsız değişkeninde artık bir GdImage nesnesi aktarmak gerekiyor; evvelce resource türünde geçerli bir gd değeri gerekirdi.

Örnekler

Örnek 1 - imagesx() örneği

<?php

// 300*200'lük bir görüntü oluşturalım
$img = imagecreatetruecolor(300, 200);

echo
imagesx($img); // çıktısı: 300

?>

Ayrıca Bakınız

add a note

User Contributed Notes 1 note

up
6
leonardo AT saochico DOT com
21 years ago
This function convert image size of Pixel to Centimeter<?#$imagem - source of image#$dpi - resolution to convert E.g.: 72dpi or 300dpifunction px2cm($image, $dpi) {    #Create a new image from file or URL    $img = ImageCreateFromJpeg($image);    #Get image width / height    $x = ImageSX($img);    $y = ImageSY($img);        #Convert to centimeter    $h = $x * 2.54 / $dpi;    $l = $y * 2.54 / $dpi;        #Format a number with grouped thousands    $h = number_format($h, 2, ',', ' ');    $l = number_format($l, 2, ',', ' ');        #add size unit    $px2cm[] = $h."cm";    $px2cm[] = $l."cm";        #return array w values    #$px2cm[0] = X    #$px2cm[1] = Y        return $px2cm;}$image = "C:\\inetpub\\wwwroot\\lab\\trata_img\\l0gik.jpg";$dpi = 300;$result = px2cm($image, $dpi);print ($result[0]." x ".$result[1]);?>
To Top