<?php
	require("../__common__/__define_common.php");
	require("../__common__/include-common-all.php");
	require("../account/__logincheck.php");

	$file_name = $_GET['file'].'';
	if (defined("photo_LIMITED_IMAGES_FOLDER") and photo_LIMITED_IMAGES_FOLDER <> '') {
		if ($_SESSION['システム管理者'] <> "YES" or photo_LIMITED_ADMIN_NOLIMIT <> 'YES') {
			$len = strlen(photo_LIMITED_IMAGES_FOLDER);
			if (substr($file_name, 0, $len) <> photo_LIMITED_IMAGES_FOLDER) {
				exit;
			}
		}
	}
	if ($file_name == '') {
		exit;
	}
	if ($_GET['ss'].'' <> '') {
		$opt_ss = ' -ss ' . $_GET['ss'].'';
	}
	$cmd = 'ffmpeg -vframes 1 -i "'.$file_name.'" -f image2'.$opt_ss.' -';
	header("Content-Type: image/jpeg");
	@passthru(mb_convert_encoding($cmd, 'SJIS-win', 'UTF-8'));
?>
