This repository has been archived on 2025-05-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
qemudb/include/screenshot.php
Jonathan Ernst dcf7c819a4 - replaced mysql_query with appdb_query
- fixed mysql query in include/session.php
2005-01-08 18:24:55 +00:00

41 lines
1.3 KiB
PHP

<?php
/********************************/
/* screenshot related functions */
/********************************/
/**
* Get a random image for a particular version of an app.
* If the version is not set, get a random app image
*/
function get_screenshot_img($appId, $versionId="")
{
if($versionId)
{
$result = query_appdb("SELECT *, RAND() AS rand FROM appData WHERE appId = $appId AND versionId = $versionId AND type = 'image' ORDER BY rand");
}
else {
$result = query_appdb("SELECT *, RAND() AS rand FROM appData WHERE appId = $appId AND type = 'image' ORDER BY rand");
}
if(!$result || !mysql_num_rows($result))
{
$imgFile = "<img src='".BASE."images/no_screenshot.gif' alt='No Screenshot' />";
}
else
{
$ob = mysql_fetch_object($result);
$imgFile = "<img src='appimage.php?imageId=$ob->id&width=128&height=128' ".
"alt='$ob->description' />";
}
$img = html_frame_start("",'128','',2);
if($versionId || mysql_num_rows($result))
$img .= "<a href='screenshots.php?appId=$appId&versionId=$versionId'>$imgFile</a>";
else // no link for adding app screenshot as screenshots are linked to versions
$img .= $imgFile;
$img .= html_frame_end()."<br />";
return $img;
}
?>