slayer1011 wrote:
I really like this,do you mind telling me how you did this (here or Via PM) or even post a how to on the phpbbgarage site, im sure lots of people would love this mod...
In the "case BROWSE" section of garage.php, replace the existing SQL down to the next comment line with the following:
Code: Select all
//Build All Required HTML
//MOD by Tony Gilbert (www.bikesonshow.com) to display thumbnail photos in the browse list instead of camera icons.
$garage_lib->build_sort_order_html($sort_order);
$sql = "SELECT g.*, makes.make, models.model, user.username, images.attach_id,
images.attach_hits, images.attach_thumb_location,
images.attach_is_image, images.attach_location, count(mods.id) AS total_mods
FROM " . GARAGE_TABLE . " AS g
LEFT JOIN " . GARAGE_MODS_TABLE . " AS mods ON mods.garage_id = g.id
LEFT JOIN " . GARAGE_IMAGES_TABLE . " AS images ON images.attach_id = g.image_id
LEFT JOIN " . GARAGE_MAKES_TABLE . " AS makes ON g.make_id = makes.id
LEFT JOIN " . GARAGE_MODELS_TABLE . " AS models ON g.model_id = models.id
LEFT JOIN " . USERS_TABLE . " AS user ON g.member_id = user.user_id
WHERE makes.pending = 0 AND models.pending = 0
".$search_data['where']."
GROUP BY g.id
ORDER BY $order_by $sort_order
LIMIT $start, " . $garage_config['cars_per_page'];
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could Not Select All Bike Data', '', __LINE__, __FILE__, $sql);
}
$i = 0;
while ($data = $db->sql_fetchrow($result) )
{
$cid = $data['id'];
if ($data['image_id'])
{
$image_attached = '<img hspace="1" vspace="1" src="' . $images['vehicle_image_attached'] . '" alt="' . $lang['Vehicle_Image_Attahced'] . '" title="' . $lang['Vehicle_Image_Attached'] . '" border="0" />';
$thumb_image = $phpbb_root_path . GARAGE_UPLOAD_PATH . $data['attach_thumb_location'];
$thumbnail_image = '<a href="garage.'.$phpEx.'?mode=view_vehicle&CID='. $data['id'] .'" title="' . $data['attach_file'] .'"><img hspace="5" vspace="5" src="' . $thumb_image .'" class="attach" /></a>';
}
else
{
$image_attached ='';
$thumbnail_image = '<a href="garage.'.$phpEx.'?mode=view_vehicle&CID='. $data['id'] .'"><img hspace="5" vspace="5" src="http://www.bikesonshow.com/phpBBplus/garage/upload/nothumb.jpg" class="attach" /></a>';
}
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('vehiclerow', array(
'ROW_NUMBER' => $i + ( $start + 1 ),
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'IMAGE_ATTACHED' => $image_attached,
'THUMBNAIL_IMAGE' => $thumbnail_image,
'YEAR' => $data['made_year'],
'MAKE' => $data['make'],
'COLOUR' => $data['color'],
'UPDATED' => create_date($board_config['default_dateformat'], $data['date_updated'], $board_config['board_timezone']),
'VIEWS' => $data['views'],
'MODS' => $data['total_mods'],
'MODEL' => $data['model'],
'OWNER' => $data['username'],
'U_VIEW_VEHICLE' => append_sid("garage.$phpEx?mode=view_vehicle&CID=$cid"),
'U_VIEW_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$data['member_id'].""))
);
$i++;
}
$db->sql_freeresult($result);
Then, in garage_browse.tpl, just replace the {vehiclerow.IMAGE_ATTACHED} with {vehiclerow.THUMBNAIL_IMAGE}. You will need to have a "no image" graphic.
As well as displaying the thumbnail, it links to the vehicle profile.
I'm not sure it's the cleanest way to do it, but it does work. I have not cleaned up the old camera icon code, which could be deleted now.
TonyG
www.bikesonshow.com