I posted my code below. I do not get any error that I can see but it does not display on the screen correctly and if I click the link it just errors. I have consulted the oracle (google) without any luck
I verified php is enabeled all the basic standard stuff: etc.
directory structure
/var/www/http
test/192
test/192/images
test/192/images/123test.jpg
test/192/images/thumbs
does not create any of the thumbnails.
I put this same code on an olderversion of linux centos 7.x and it works just fine. any help would be much appreciated:
Thank you
Tony
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<TITLE>THIS IS A TEST</TITLE>
<h1> IMAGES #123456 </h1>
</HEAD>
<BODY>
<form action="http://10.1.1.1/test/192/mailer.html" method="post">
<?php
function filename_extension($filename) {
$pos = strrpos($filename, ".");
if($pos===false) {
return false;
} else {
return substr($filename, $pos+1);
}
}
$handle = opendir("../192/images");
$valext = array("gif","tif","tiff","jpg","jpeg","png","pdf");
print "handle"
print $handle
if ($handle) {
while (false !== ($file = readdir($handle))) {
if (($file[0] !== ".") || ($file !== "..") || ($file !== "*.php"))
{
if ( ! is_dir("images/$file") ) {
$size = filesize("images/$file");
if ( $size === 0 ) {
continue;
}
$ext = filename_extension("$file");
$lext = strtolower($ext);
$newfile = basename("$file",".$lext");
foreach( $valext as $vext ) {
if ( "$lext" === "$vext" ) {
if ( "$lext" === "pdf" || "$lext" === "gif" ) {
$cmd = "/usr/bin/convert -sample 20x20% images/$newfile.$ext\[0\] images/thumbs/$newfile.png";
} else {
$cmd = "/usr/bin/convert -sample 20x20% images/$newfile.$ext images/thumbs/$newfile.png";
}
$imgfile = "$newfile.png";
$res = array();
exec($cmd,$res);
}
}
} else {
continue;
}
print "<table border=1 align=left/>";
print "<tr><th></th><th>Image Date</th><th>ID #</th><th>Port #</th><th>TYPE</th></tr>";
print "<tr><td><a href=images/$file /a><img src=images/thumbs/$imgfile border=0 align=middle /></td><td>2011-07-18</td><td>153</td><td>224</td><td>$lext</td></tr>";
print "</table>";
}
}
}
closedir($handle);
?>
</form>
</BODY>
</HTML>