equal
deleted
inserted
replaced
248 $extension = $row['file_extension']; |
248 $extension = $row['file_extension']; |
249 if ( isset($_GET['fmt']) && in_array($_GET['fmt'], array('png', 'jpg')) ) |
249 if ( isset($_GET['fmt']) && in_array($_GET['fmt'], array('png', 'jpg')) ) |
250 $extension = ".{$_GET['fmt']}"; |
250 $extension = ".{$_GET['fmt']}"; |
251 |
251 |
252 $cache_filename = ENANO_ROOT . "/cache/{$filename}-{$row['time_id']}-{$width}x{$height}$extension"; |
252 $cache_filename = ENANO_ROOT . "/cache/{$filename}-{$row['time_id']}-{$width}x{$height}$extension"; |
253 if ( file_exists($cache_filename) ) |
253 if ( file_exists($cache_filename) && !isset($_GET['cache_override']) ) |
254 { |
254 { |
255 $fname = $cache_filename; |
255 $fname = $cache_filename; |
256 } |
256 } |
257 else |
257 else |
258 { |
258 { |
279 $allow_scale = true; |
279 $allow_scale = true; |
280 } |
280 } |
281 } |
281 } |
282 if ( $allow_scale ) |
282 if ( $allow_scale ) |
283 { |
283 { |
284 $result = scale_image($orig_fname, $fname, $width, $height); |
284 $result = scale_image($orig_fname, $fname, $width, $height, isset($_GET['cache_override'])); |
285 if ( !$result ) |
285 if ( !$result ) |
286 $fname = $orig_fname; |
286 $fname = $orig_fname; |
287 } |
287 } |
288 else |
288 else |
289 { |
289 { |
299 header('Content-type: '.$row['mimetype']); |
299 header('Content-type: '.$row['mimetype']); |
300 if ( isset($_GET['download']) ) |
300 if ( isset($_GET['download']) ) |
301 { |
301 { |
302 header('Content-disposition: attachment, filename="' . $filename . '";'); |
302 header('Content-disposition: attachment, filename="' . $filename . '";'); |
303 } |
303 } |
304 if ( !@$GLOBALS['do_gzip'] ) |
304 //if ( !@$GLOBALS['do_gzip'] ) |
305 header('Content-length: ' . $len); |
305 header('Content-length: ' . $len); |
306 |
306 |
307 header('Last-Modified: '.enano_date('r', $row['time_id'])); |
307 header('Last-Modified: '.enano_date('r', $row['time_id'])); |
308 |
308 |
309 // using this method limits RAM consumption |
309 // using this method limits RAM consumption |
|
310 @ob_end_flush(); |
310 while ( !feof($handle) ) |
311 while ( !feof($handle) ) |
311 { |
312 { |
312 echo fread($handle, 512000); |
313 echo fread($handle, 512000); |
313 } |
314 } |
314 fclose($handle); |
315 fclose($handle); |
315 |
316 |
316 gzip_output(); |
317 $db->close(); |
317 |
318 |
318 exit; |
319 exit; |
319 |
320 |
320 } |
321 } |
321 |
322 |