Mercurial > hg > mgallery
changeset 301:b72da68991ed
Improve few comments.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 26 Mar 2020 11:15:33 +0200 |
parents | 7bccb4204e6e |
children | f8d812d3194f |
files | mgtool.php |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mgtool.php Thu Mar 26 10:54:51 2020 +0200 +++ b/mgtool.php Thu Mar 26 11:15:33 2020 +0200 @@ -118,6 +118,7 @@ $dim = $img->getImageGeometry(); $img->setGravity(imagick::GRAVITY_CENTER); + // Width smaller than height? Swap dimensions if ($dim["width"] < $dim["height"]) { $stmp = $outDim[0]; @@ -125,6 +126,7 @@ $outDim[1] = $stmp; } + // Compute new height if needed if ($dim["width"] != $outDim[0] || $dim["height"] != $outDim[1]) { $outDim[1] = ($dim["height"] * $outDim[0]) / $dim["width"]; @@ -192,6 +194,7 @@ $dim = $img->getImageGeometry(); //$img->setGravity(Gmagick::GRAVITY_CENTER); + // Compute new height if needed if ($dim["width"] < $dim["height"]) { $stmp = $outDim[0]; @@ -199,6 +202,7 @@ $outDim[1] = $stmp; } + // Compute new height if needed if ($dim["width"] != $outDim[0] || $dim["height"] != $outDim[1]) { $outDim[1] = ($dim["height"] * $outDim[0]) / $dim["width"]; @@ -246,8 +250,8 @@ // -// Read and parse XMP data from given file -// .. a horrible hack. +// Read XMP data block from given file +// .. it's a horrible hack. // function mgReadXMPData($filename, $xmpBlockSize = 1024*64) { @@ -348,8 +352,7 @@ if (($xmpOb = @simplexml_load_string($xmpStr)) === FALSE) return FALSE; - // Process structure to simple flat array of data - // for the desired elements only + // Process structure to simple flat array of data for the desired elements only $xmpData = []; //if (($tmp = $xmpOb->xpath("RDF/Description/description/li")) !== FALSE) @@ -966,7 +969,7 @@ $updFlags |= GUPD_CAPTION; // Check for XMP info - // TODO XXX: Support XMP sidecar files + // TODO XXX: Perhaps support XMP sidecar files if (($updFlags & GUPD_EXIF_INFO) && ($xmpStr = mgReadXMPData($efilename)) !== FALSE && ($xmp = mgParseXMPData($xmpStr)) !== FALSE)