imageresolution

(PHP 7 >= 7.2.0, PHP 8)

imageresolutionGet or set the resolution of the image

Beschreibung

imageresolution(GdImage $image, ?int $resolution_x = null, ?int $resolution_y = null): array|bool

imageresolution() allows to set and get the resolution of an image in DPI (dots per inch). If the optional parameters are null, the current resolution is returned as an indexed array. If only resolution_x is not null, the horizontal and vertical resolution are set to this value. If none of the optional parameters are null, the horizontal and vertical resolution are set to these values, respectively.

The resolution is only used as meta information when images are read from and written to formats supporting this kind of information (curently PNG and JPEG). It does not affect any drawing operations. The default resolution for new images is 96 DPI.

Parameter-Liste

image

Ein GdImage-Objekt, das von einer der Funktionen zur Bilderzeugung, z. B. imagecreatetruecolor(), zurückgegeben wurde.

resolution_x

The horizontal resolution in DPI.

resolution_y

The vertical resolution in DPI.

Rückgabewerte

When used as getter, it returns an indexed array of the horizontal and vertical resolution on success, Bei einem Fehler wird false zurückgegeben.. When used as setter, it returns true on success, Bei einem Fehler wird false zurückgegeben..

Changelog

Version Beschreibung
8.0.0 resolution_x and resolution_y are now nullable.

Beispiele

Beispiel #1 Setting and getting the resolution of an image

<?php
$im 
imagecreatetruecolor(100100);
imageresolution($im200);
print_r(imageresolution($im));
imageresolution($im30072);
print_r(imageresolution($im));
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

Array
(
    [0] => 200
    [1] => 200
)
Array
(
    [0] => 300
    [1] => 72
)

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Grundlagen von Views in MySQL

Views in einer MySQL-Datenbank bieten die Möglichkeit, eine virtuelle Tabelle basierend auf dem Ergebnis einer SQL-Abfrage zu erstellen. ...

admin

Autor : admin
Kategorie: mySQL-Tutorials

Definition von Stored Procedures - eine Einführung

Stored Procedures sind vordefinierte SQL-Codeblöcke, die in einer Datenbank gespeichert sind und bei Bedarf aufgerufen werden können. ...

Bernie

Autor : ebiz-consult GmbH & Co. KG
Kategorie: mySQL-Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

What defines Laravel's developer community?

Wenn Sie Ihr eigenes soziales Netzwerk erstellen möchten, empfehle ich Ihnen, den Blog zu lesen, in dem alles beschrieben ist https://merehead.co ...

Geschrieben von jord2 am 02.05.2024 13:44:45
Forum: PHP Developer Forum
Ich bin am verrückt werden - Session und neue Webseite

That is an extremely bright idea

Geschrieben von EssaMattou am 02.05.2024 09:34:57
Forum: SQL / Datenbanken
"Why adore HTMX over JavaScript?"

What specific features or aspects of HTMX, a library designed to enhance interactions in web applications, appeal to users who have a strong affin ...

Geschrieben von WartanThamar am 02.05.2024 06:53:08
Forum: HTML, JavaScript, AJAX, jQuery, CSS, Bootstrap, LESS