Image Dimensions

RJM Programming - October, 2017

Thanks to ImageMagick

"; $prefix=""; if (isset($_GET['imagespec'])) { $ximage=urldecode($_GET['imagespec']); $imagespec = str_replace("//www.rjmprogramming.com.au/","/home/rjmprogr/public_html/",str_replace("//rjmprogramming.com.au/","/home/rjmprogr/public_html/",str_replace("http://www.rjmprogramming.com.au/","/home/rjmprogr/public_html/",str_replace("http://rjmprogramming.com.au/","/home/rjmprogr/public_html/",str_replace("https://www.rjmprogramming.com.au/","/home/rjmprogr/public_html/",str_replace("https://rjmprogramming.com.au/","/home/rjmprogr/public_html/",urldecode($_GET['imagespec']))))))); } else if (isset($_POST['imagespec'])) { $ximage=urldecode($_POST['imagespec']); $imagespec = str_replace("//www.rjmprogramming.com.au/","/home/rjmprogr/public_html/",str_replace("//rjmprogramming.com.au/","/home/rjmprogr/public_html/",str_replace("http://www.rjmprogramming.com.au/","/home/rjmprogr/public_html/",str_replace("http://rjmprogramming.com.au/","/home/rjmprogr/public_html/",str_replace("https://www.rjmprogramming.com.au/","/home/rjmprogr/public_html/",str_replace("https://rjmprogramming.com.au/","/home/rjmprogr/public_html/",urldecode($_POST['imagespec']))))))); } else if (1 == 2 && file_exists("/Applications/MAMP/htdocs/clouds.jpg")) { $imagespec = "/Applications/MAMP/htdocs/clouds.jpg"; } else { $ximage="http://www.rjmprogramming.com.au/fillThisIn*YouGetIt*.*g*"; } $topbit.="

        Image URL Specification:   

"; if ($imagespec != "") { $ximage=$imagespec; //if (strpos($_SERVER['SERVER_NAME'], "rjmprogramming.com.au") !== false) { if (isset($_POST['widthminus'])) { exec($prefix . "identify " . $imagespec . " | sed '/ [1-9][0-9]*c /s// /g' | awk -F'[' '{ b=$1; gsub(\" \",\"@\",b); c=$0; gsub($1, b, c); print c; }' | awk -F' ' '{ c=substr($0,(1 + length($1))); b=$1; gsub(\" \",\"!@!\",b); print b \">\" b c; }' | sed '/ /s//\<\/img\>\<\/a\> /' | sed '/\[[1-9][0-9]*\]/s///g' | sed '/^/s//!/g' | sed '/$/s//`/g' | sort -k3 -n -t' ' > /tmp/pnginfo.txt"); } else if (isset($_POST['width'])) { exec($prefix . "identify " . $imagespec . " | sed '/ [1-9][0-9]*c /s// /g' | awk -F'[' '{ b=$1; gsub(\" \",\"@\",b); c=$0; gsub($1, b, c); print c; }' | awk -F' ' '{ c=substr($0,(1 + length($1))); b=$1; gsub(\" \",\"!@!\",b); print b \">\" b c; }' | sed '/ /s//\<\/img\>\<\/a\> /' | sed '/\[[1-9][0-9]*\]/s///g' | sed '/^/s//!/g' | sed '/$/s//`/g' | sort -k3 -n -r -t' ' > /tmp/pnginfo.txt"); } else if (isset($_POST['heightminus'])) { exec($prefix . "identify " . $imagespec . " | sed '/ [1-9][0-9]*c /s// /g' | awk -F'[' '{ b=$1; gsub(\" \",\"@\",b); c=$0; gsub($1, b, c); print c; }' | awk -F' ' '{ c=substr($0,(1 + length($1))); b=$1; gsub(\" \",\"!@!\",b); gsub(\"x\",\" 00\",c); b=$1; gsub(\" \",\"!@!\",b); print b \">\" b c; }' | sed '/ /s//\<\/img\>\<\/a\> /' | sed '/\[[1-9][0-9]*\]/s///g' | sed '/^/s//!/g' | sed '/$/s//`/g' | sort -k4 -n -t' ' | sed '/ 00/s//x/g' | sed '/#/s//x/g' > /tmp/pnginfo.txt"); } else if (isset($_POST['height'])) { exec($prefix . "identify " . $imagespec . " | sed '/ [1-9][0-9]*c /s// /g' | awk -F'[' '{ b=$1; gsub(\" \",\"@\",b); c=$0; gsub($1, b, c); print c; }' | awk -F' ' '{ c=substr($0,(1 + length($1))); b=$1; gsub(\" \",\"!@!\",b); gsub(\"x\",\" 00\",c); b=$1; gsub(\" \",\"!@!\",b); print b \">\" b c; }' | sed '/ /s//\<\/img\>\<\/a\> /' | sed '/\[[1-9][0-9]*\]/s///g' | sed '/^/s//!/g' | sed '/$/s//`/g' | sort -k4 -n -r -t' ' | sed '/ 00/s//x/g' | sed '/#/s//x/g' > /tmp/pnginfo.txt"); } else { exec($prefix . "identify " . $imagespec . " | sed '/ [1-9][0-9]*c /s// /g' | awk -F'[' '{ b=$1; gsub(\" \",\"@\",b); c=$0; gsub($1, b, c); print c; }' | awk -F' ' '{ c=substr($0,(1 + length($1))); b=$1; gsub(\" \",\"!@!\",b); print b \">\" b c; }' | sed '/ /s//\<\/img\>\<\/a\> /' | sed '/\[[1-9][0-9]*\]/s///g' | sed '/^/s//!/g' | sed '/$/s//`/g' > /tmp/pnginfo.txt"); } $topbit.=str_replace("@"," ",str_replace("imgsrc=","img style=width:45px; src=",str_replace("!","", str_replace("/home/rjmprogr/public_html/","http://www.rjmprogramming.com.au/", str_replace("/Applications/MAMP/htdocs/","http://localhost:8888/", @file_get_contents("/tmp/pnginfo.txt")))))))); //} else { //echo '/opt/local/bin/identify ' . $imagespec . ' > /tmp/pnginfo.txt'; //exec("/opt/local/bin/identify " . $imagespec . " | awk -F' ' '{ print $1 \">\" $0; }' | sed '/ /s//\<\/img\>\<\/a\> /' | sed '/\[[1-9][0-9]*\]/s///g' | sed '/^/s//!/g' | sed '/$/s//`/g' > /tmp/pnginfo.txt"); //$topbit.=str_replace("imgsrc=","img style=width:45px; src=",str_replace("!","", str_replace("/home/rjmprogr/public_html/","http://www.rjmprogramming.com.au/", str_replace("/Applications/MAMP/htdocs/","http://localhost:8888/", @file_get_contents("/tmp/pnginfo.txt"))))))); //echo file_get_contents("/tmp/pnginfo.txt"); //} } echo $topbit . "
Image NameImage Type x MoreImage Bit ModeColour SpaceSize
",str_replace("`","
",str_replace("`","
"; ?>