bradgrafelman wrote:I'm getting confused, so can you explain in simple terms what it is you're trying to do?
of course i can 🙂
sorry for being confusing on all this,,,, thing is very simple, in the beginning i had this code:
<?
include("includes.php");
SetShowErrors();
$dir = "image/galerije/ups/".$_GET['id']."/";
$columns = 3;
$thmb_width = 100;
$thmb_height = 100;
function resizeImage($originalImage,$toWidth,$toHeight){
list($width, $height) = getimagesize($originalImage);
$xscale=$width/$toWidth;
$yscale=$height/$toHeight;
if ($yscale>$xscale){
$new_width = round($width * (1/$yscale));
$new_height = round($height * (1/$yscale));
}
else {
$new_width = round($width * (1/$xscale));
$new_height = round($height * (1/$xscale));
}
$imageResized = imagecreatetruecolor($new_width, $new_height);
$imageTmp = imagecreatefromjpeg ($originalImage);
imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0,
$new_width, $new_height, $width, $height);
return $imageResized;
}
function generateThumbnails(){
global $thmb_width,$thmb_height,$dir;
if ($handle = opendir($dir)) {
while ($file0 = readdir($handle)) {
$file = $dir.$file0;
if (is_file($file)){
if (strpos($file,'_th.jpg')){
$isThumb = true;
} else {
$isThumb = false;
}
if (!$isThumb) {
$dirName = substr($file,0,strpos($file,basename($file)));
if (strlen($dirName) < 1) $dirName = $dir;
$fileName = basename($file);
$fileMain = substr($fileName,0,strrpos($fileName,'.'));
$extName = substr($fileName,strrpos($fileName,'.'),
strlen($fileName)-strrpos($fileName,'.'));
if (($extName == '.jpg') || ($extName == '.jpeg')){
$thmbFile = $dirName.'/'.$fileMain.'_th.jpg';
if (!file_exists($thmbFile)){
imagejpeg(resizeImage($file,$thmb_width,$thmb_height)
,$thmbFile,80);
}
}
}
}
}
}
}
function getNormalImage($file){
$base = substr($file,0,strrpos($file,'_th.jpg'));
if (file_exists($base.'.jpg')) return $base.'.jpg';
elseif (file_exists($base.'.jpeg')) return $base.'.jpeg';
else return "";
}
function displayPhotos(){
global $columns,$dir;
generateThumbnails();
$act = 0;
if ($handle = opendir($dir)) {
while ($file1 = readdir($handle)) {
$file = $dir.$file1;
if (is_file($file)){
if (strpos($file,'_th.jpg')){
++$act;
if ($act > $columns) {
echo "</tr><tr><td><a href='galerije_infinito.php?z=".getNormalImage($file)."&l_id=".$_GET['id']."'><img src='".$file."'></a></td>";
$act = 1;
} else {
echo "<td><a href='galerije_infinito.php?z=".getNormalImage($file)."&l_id=".$_GET['id']."'><img src='".$file."'></a></td>";
}
}
}
}
}
}
?>
i also have one table with a comment for each picture displayed from code above. what i want to do is to display that comment in last two echo lines (87 and 93) so they would look something like this:
echo "<td><a href='galerije_infinito.php?z=".getNormalImage($file)."&l_id=".$_GET['id']."'><img src='".$file."'><br>".$row['koment']."</a></td>";
did i made myself clear now? sorry for confusion really 😉