All pastes #990677 Raw Edit

Untitled

public text v1 · immutable
#990677 ·published 2008-04-20 10:23 UTC
rendered paste body
<?php
	
	if (is_object($mmhclass) == false) {
		exit;
	}

	header("Content-Type: image/jpeg;");
	header("Content-Disposition: inline; filename=thumbnail.jpg;");

	$thumbnail = $mmhclass->funcs->thumbnail_name(basename($mmhclass->input->get_vars['file']));

	if ($mmhclass->funcs->is_null($mmhclass->input->get_vars['file']) == true || is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$thumbnail) == false) {
		readfile("{$mmhclass->info->root_path}css/images/no_thumbnail.jpg");
	} else {
		/* Edit by Ahmed: Regenerate thumbnails if they were generated before the modification time of this file. */
		if (filemtime($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$thumbnail) < filemtime(__FILE__)) {
			$mmhclass->funcs->create_thumbnail(basename($mmhclass->input->get_vars['file']));
		}
	
		readfile($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$thumbnail);
	}
	
	exit;

?>