? order by ref limit 1", $parameters); if (count($latest)==0) { # There are no subsequent uploads. The current file is the latest one. $image_path=get_resource_path($resource,true,"thm"); if (file_exists($image_path)) { $image = get_resource_path($resource,false,"thm"); } else{ $image = $baseurl . '/gfx/no_preview/default.png'; } } else { # We've found a more recent upload; the upload therefore is represented in the alternative file for this. $alt_file=$latest[0]["previous_file_alt_ref"]; if (isset($alt_file)) { $alter_data = get_alternative_file($resource,$alt_file); } $image_path=get_resource_path($resource, true, 'thm', true, "", -1, 1, false, "", $alt_file); if (file_exists($image_path)) { $image=get_resource_path($resource, false, 'thm', true, "", -1, 1, false, "", $alt_file); } else { // If an image does not exist, get a nopreview image by looking at the extension of the alternative file $image = $baseurl . '/gfx/no_preview/default.png'; } } echo "