...

View Full Version : Help with image output, one image missing!



idealws
05-21-2008, 12:47 AM
Hello,

I have a piece of code that outputs images to the browser and alternates
them in a table for instance:

Image 1 Image 2 Image 3

Image 4 Image 5 Image 6

and so on. However it is not showing all the images it is dropping one of them
from the data. So if I have 9 images I only see 8. I am not sure why this is
and cannnot come up with a fix. Any help would be greatly apopreciated.

Here is the block of code I am having trouble with:


$frontimgresults = $db->MySQLQuery("SELECT * FROM ".$config['database']['tblimages']." WHERE vid='".$vehinfo['stock']."'");
$y = 1;
while($showimages = mysql_fetch_array($frontimgresults)) {
if($y % 4) {
$thisfilename = basename($showimages['image']);
if(!is_file("images/vehimages/".$thisfilename)) {
$newfilename = $db->copyFile($showimages['image'], "images/vehimages/");
}else{
$newfilename = $thisfilename;
}
// Lets see if there is a thumbnail already
if(!is_file("images/vehimages/thumbs/small/thumbnail_".$newfilename)) {
// If no thumbnail then we will creeate one.
if($showimages['offsite']) {
$db->create_small_thumbnail("images/vehimages/",$newfilename,"images/vehimages/thumbs/small/");
}else{
$db->create_small_thumbnail("images/vehimages/",$showimages['image'],"images/vehimages/thumbs/small/");
}
}
if($showimages['offsite']) {
echo "<td align=\"center\"><a href=\"".MAIN_URL."/images/vehimages/".basename($showimages['image'])."\" onmouseover=\"showImage2('".MAIN_URL."/images/vehimages', '".basename($showimages['image'])."');\" style=\"border: 0; cursor: hand;\" rel=\"lightbox[cars]\"><img src=\"".MAIN_URL."/images/vehimages/thumbs/small/thumbnail_".basename($showimages['image'])."\" width=\"72\" height=\"72\" class=\"border\" alt=\"Click for larger image\"></a></td>\n";
}else{
echo "<td align=\"center\"><a href=\"".MAIN_URL."/images/vehimages/".$showimages['image']."\" onmouseover=\"showImage2('".MAIN_URL."/images/vehimages', '".$showimages['image']."');\" style=\"border: 0; cursor: hand;\" rel=\"lightbox[cars]\"><img src=\"".MAIN_URL."/images/vehimages/thumbs/small/thumbnail_".$showimages['image']."\" width=\"72\" height=\"72\" class=\"border\" alt=\"Click for larger image\"></a></td>\n";
}
}else{
$thisfilename = basename($showimages['image']);
if(!is_file("images/vehimages/".$thisfilename)) {
$newfilename = $db->copyFile($showimages['image'], "images/vehimages/");
}else{
$newfilename = $thisfilename;
}
// Lets see if there is a thumbnail already
if(!is_file("images/vehimages/thumbs/small/thumbnail_".$newfilename)) {
// If no thumbnail then we will creeate one.
if($showimages['offsite']) {
$db->create_small_thumbnail("images/vehimages/",$newfilename,"images/vehimages/thumbs/small/");
}else{
$db->create_small_thumbnail("images/vehimages/",$showimages['image'],"images/vehimages/thumbs/small/");
}
}
if($showimages['offsite']) {
echo "<td align=\"center\"><a href=\"".MAIN_URL."/images/vehimages/".basename($showimages['image'])."\" onmouseover=\"showImage2('".MAIN_URL."/images/vehimages', '".basename($showimages['image'])."');\" style=\"border: 0; cursor: hand;\" rel=\"lightbox[cars]\"><img src=\"".MAIN_URL."/images/vehimages/thumbs/small/thumbnail_".basename($showimages['image'])."\" width=\"72\" height=\"72\" class=\"border\" alt=\"Click for larger image\"></a></td></tr><tr>";
}else{
echo "<td align=\"center\"><a href=\"".MAIN_URL."/images/vehimages/".$showimages['image']."\" onmouseover=\"showImage2('".MAIN_URL."/images/vehimages', '".$showimages['image']."');\" style=\"border: 0; cursor: hand;\" rel=\"lightbox[cars]\"><img src=\"".MAIN_URL."/images/vehimages/thumbs/small/thumbnail_".$showimages['image']."\" width=\"72\" height=\"72\" class=\"border\" alt=\"Click for larger image\"></a></td></tr><tr>\n";
}
}
$y++;
}


Thanks in advance for any help you can give.

Regards,
Ray

peteyb383
05-21-2008, 01:14 AM
Which image is being left out? Like, if you had 9 images and they were going into the table in the order of most recent to least recent, which is getting lost, the most recent one or the least recent one?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum