Use the url field from appData and not the id as the name of the file in the filesystem. It is only lately that the filenames of images are equal to the id of the row in the appData table
This commit is contained in:
18
appimage.php
18
appimage.php
@@ -24,11 +24,23 @@ if ($_REQUEST['REQUEST_METHOD']='HEAD')
|
||||
errorpage("Bad parameter");
|
||||
exit;
|
||||
}
|
||||
$sQuery = "SELECT id FROM appData
|
||||
$sQuery = "SELECT id, url FROM appData
|
||||
WHERE id = ".$iId."
|
||||
AND type = 'image' LIMIT 1";
|
||||
if (!($hResult = query_appdb($sQuery) &&
|
||||
$fImage = fopen(appdb_fullpath("data/screenshots/".$iId), "rb")))
|
||||
$hResult = query_appdb($sQuery);
|
||||
$fImage = 0;
|
||||
if($hResult)
|
||||
{
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
|
||||
/* we need to use the url field from appData, this is the name of the file */
|
||||
/* in the filesystem */
|
||||
$fImage = fopen(appdb_fullpath("data/screenshots/".$oRow->id), "rb");
|
||||
}
|
||||
|
||||
/* if the query failed or if we didn't find the image, we should */
|
||||
/* report a 404 to the browser */
|
||||
if(!$hResult || !$fImage)
|
||||
{
|
||||
header("404 No such image");
|
||||
exit;
|
||||
|
||||
Reference in New Issue
Block a user