note 128772 added to function.imagesx

From: Date: Wed, 02 Aug 2023 02:00:07 +0000
Subject: note 128772 added to function.imagesx
Groups: php.notes 
Request: Send a blank email to php-notes+get-220732@lists.php.net to get a copy of this message
Observando um exemplo em um dos comentários resolvi criar uma versão alternativa, onde se possa através da largura x altura x dpi, converter para pixel. Obs: É claramente uma modificação de um comentário anterior. Portanto não sou o autor e os créditos são do autor original. <?php #$dpi - resolution to convert E.g.: 72dpi or 300dpi function cm2px($width, $height, $dpi) { #Get image width / height $x = $width; $y = $height; #Convert to pixel $h = $x * $dpi / 2.54; $l = $y * $dpi / 2.54; #Format a number with grouped thousands $h = number_format($h, 0, '.', ' '); $l = number_format($l, 0, '.', ' '); #add size unit $cm2px[] = $h; $cm2px[] = $l; #return array w values #cm2px[0] = X #cm2px[1] = Y return $cm2px; } $width = 10; $height = 15; $dpi = 300; $result = cm2px($width, $height, $dpi); print ($result[0]." x ".$result[1]); ?> ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 189.24.80.223) ---- Manual Page -- https://php.net/manual/en/function.imagesx.php Edit -- https://main.php.net/note/edit/128772 Del: integrated -- https://main.php.net/note/delete/128772/integrated Del: useless -- https://main.php.net/note/delete/128772/useless Del: bad code -- https://main.php.net/note/delete/128772/bad+code Del: spam -- https://main.php.net/note/delete/128772/spam Del: non-english -- https://main.php.net/note/delete/128772/non-english Del: in docs -- https://main.php.net/note/delete/128772/in+docs Del: other reasons-- https://main.php.net/note/delete/128772 Reject -- https://main.php.net/note/reject/128772 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220732) next »