Compact the top 'X' lists on the main page by adding a flag to get_screenshot_img() that disables the output of

html that was putting the image inside of another table
This commit is contained in:
Chris Morgan
2006-06-22 21:41:41 +00:00
committed by WineHQ
parent 2076ff9efc
commit b55c2776a5
2 changed files with 19 additions and 7 deletions

View File

@@ -303,8 +303,10 @@ class Screenshot {
/**
* Get a random image for a particular version of an app.
* If the version is not set, get a random app image
*
* $bFormatting == false turns off all extranious formatting applied to the returned image html
*/
function get_screenshot_img($iAppId = null, $iVersionId = null)
function get_screenshot_img($iAppId = null, $iVersionId = null, $bFormatting = true)
{
// we want a random screenshots for this app
if($iAppId && !$iVersionId)
@@ -325,15 +327,23 @@ function get_screenshot_img($iAppId = null, $iVersionId = null)
AND queued = 'false'
ORDER BY rand");
}
if($bFormatting)
$sImgFile .= '<center>';
if(!$hResult || !mysql_num_rows($hResult))
{
$sImgFile = '<center><img src="images/no_screenshot.png" alt="No Screenshot" /></center>';
$sImgFile = '<img src="images/no_screenshot.png" alt="No Screenshot" />';
} else
{
$oRow = mysql_fetch_object($hResult);
$sImgFile = '<center><img src="appimage.php?thumbnail=true&amp;id='.$oRow->id.'" alt="'.$oRow->description.'" /></center>';
$sImgFile = '<img src="appimage.php?thumbnail=true&amp;id='.$oRow->id.'" alt="'.$oRow->description.'" />';
}
if($bFormatting)
$sImgFile .= '</center>';
if($bFormatting)
$sImg = html_frame_start("",'128','',2);
/* we have screenshots */
@@ -350,6 +360,8 @@ function get_screenshot_img($iAppId = null, $iVersionId = null)
{
$sImg .= $sImgFile;
}
if($bFormatting)
$sImg .= html_frame_end()."<br />";
return $sImg;

View File

@@ -266,12 +266,12 @@ function outputTopXRow($oRow)
{
$oVersion = new Version($oRow->versionId);
$oApp = new Application($oVersion->iAppId);
$img = get_screenshot_img(null, $oRow->versionId); // image
$img = get_screenshot_img(null, $oRow->versionId, false); // image, disable extra formatting
echo '
<tr class="white">
<td><a href="appview.php?versionId='.$oRow->versionId.'">'.$oApp->sName.' '.$oVersion->sName.'</a></td>
<td>'.trim_description($oApp->sDescription).'</td>
<td>'.$img.'</td>
<td><center>'.$img.'</center></td>
</tr>';
}