My Opera is closing 3rd of March

A blog

^^^ hmm... jup that's what it is

PHP Scripts: Image Resolution...

In a web world images have no resolution... err at least no controllable resolution. (that remains client side) Unfortunately that mentality fills the PHP coding forums and blogs. Searching for an ext or class that returns the resolution of an image only results in a plethora of obnoxious teenage retards flaming those that need a solution. Wait, why would you need the 'resolution' - one answer - Print output. Specifically PDF. So unless you disregard the content creator's intent of a certain resolution you cannot faithfully render an image at a specific size in PDF unless you have the resolution as a basis for your math. You see we need the resolution to calc out the size in points based on the actual pixel dimensions... e.g.
$elevation = "images/elevationNA.jpg"

$elevation_size	= getimagesize($elevation);
$elevation_tmp	= new Imagick($elevation);
$elevation_res	= $elevation_tmp->getImageResolution();

$elevation_X = ($elevation_size[0] / $elevation_res['x']) * 72;
$elevation_Y = ($elevation_size[1] / $elevation_res['y']) * 72;


echo "X width (px): " . $elevation_size[0] . "<br />";
echo "Y width (px): " . $elevation_size[1] . "<br />";

echo "X width (pts): " . $elevation_res['x'] . "<br />";
echo "Y width (pts): " . $elevation_res['y'] . "<br />";

echo "X width (pts): " . $elevation_X . "<br />";
echo "Y width (pts): " . $elevation_Y . "<br />";

On going battle w/ MSI and lack of Engrish skills...CreativeTechShop.com Launched!

Write a comment

New comments have been disabled for this post.