image refresher
This commit is contained in:
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
require_once 'settings.php';
|
require_once 'settings.php';
|
||||||
|
|
||||||
|
define(TMP_FOLDER, 'tmp/');
|
||||||
|
|
||||||
function getPage($sPath, $asVars, $sType)
|
function getPage($sPath, $asVars, $sType)
|
||||||
{
|
{
|
||||||
$bSavePage = Settings::DEBUG;
|
$bSavePage = Settings::DEBUG;
|
||||||
@@ -9,7 +11,7 @@ function getPage($sPath, $asVars, $sType)
|
|||||||
{
|
{
|
||||||
$asFileIds = array_filter($asVars);
|
$asFileIds = array_filter($asVars);
|
||||||
unset($asFileIds['_']);
|
unset($asFileIds['_']);
|
||||||
$sFileName = $sPath.'.'.implode('.', $asFileIds).'.log';
|
$sFileName = TMP_FOLDER.$sPath.'.'.implode('.', $asFileIds).'.log';
|
||||||
}
|
}
|
||||||
if(!$bSavePage || !file_exists($sFileName) || date('dmY', filemtime($sFileName))!=date('dmY'))
|
if(!$bSavePage || !file_exists($sFileName) || date('dmY', filemtime($sFileName))!=date('dmY'))
|
||||||
{
|
{
|
||||||
@@ -45,10 +47,11 @@ function setPageMime($sType='html')
|
|||||||
if($sType!='html' && array_key_exists($sType, $asMainTypes)) header('Content-type: '.$asMainTypes[$sType].'/'.$sType);
|
if($sType!='html' && array_key_exists($sType, $asMainTypes)) header('Content-type: '.$asMainTypes[$sType].'/'.$sType);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTrimImage($iFilmId, $sSize, $sinPath, $sImageExt)
|
function getTrimImage($iFilmId, $sSize, $sinPath, $sImageExt, $bForce=false)
|
||||||
{
|
{
|
||||||
$sOutPath = 'images/'.$iFilmId.'_'.$sSize.'.'.$sImageExt;
|
$sOutPath = TMP_FOLDER.$iFilmId.'_'.$sSize.'.'.$sImageExt;
|
||||||
if(!file_exists($sOutPath))
|
$bFileExist = file_exists($sOutPath);
|
||||||
|
if(!$bFileExist || $bForce)
|
||||||
{
|
{
|
||||||
$oImage = call_user_func('imagecreatefrom'.$sImageExt, $sinPath);
|
$oImage = call_user_func('imagecreatefrom'.$sImageExt, $sinPath);
|
||||||
$iImageX = imagesx($oImage);
|
$iImageX = imagesx($oImage);
|
||||||
@@ -117,6 +120,10 @@ function getTrimImage($iFilmId, $sSize, $sinPath, $sImageExt)
|
|||||||
//Copy the content, excluding the border
|
//Copy the content, excluding the border
|
||||||
imagecopy($oCropImage, $oImage, 0, 0, $iLeft, $iTop, imagesx($oCropImage), imagesy($oCropImage));
|
imagecopy($oCropImage, $oImage, 0, 0, $iLeft, $iTop, imagesx($oCropImage), imagesy($oCropImage));
|
||||||
|
|
||||||
|
//Remove existing image
|
||||||
|
if($bFileExist) unlink($sOutPath);
|
||||||
|
|
||||||
|
//Store image
|
||||||
call_user_func_array('image'.$sImageExt, array($oCropImage, $sOutPath));
|
call_user_func_array('image'.$sImageExt, array($oCropImage, $sOutPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ switch($sAction)
|
|||||||
$sResult = getPage($asData['path'], $asData['vars'], $sType);
|
$sResult = getPage($asData['path'], $asData['vars'], $sType);
|
||||||
break;
|
break;
|
||||||
case 'get_poster':
|
case 'get_poster':
|
||||||
$sResult = getTrimImage($asData['id'], $asData['size'], $asData['url'], $sType);
|
$sResult = getTrimImage($asData['id'], $asData['size'], $asData['url'], $sType, $asData['force']);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$sResult = file_get_contents('masks/index.html');
|
$sResult = file_get_contents('masks/index.html');
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||||
<meta name="author" content="Franzz" />
|
<meta name="author" content="Franzz" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=0.5">
|
<meta name="viewport" content="width=device-width, initial-scale=0.5">
|
||||||
<link rel='shortcut icon' href='favicon.ico' type='image/x-icon' />
|
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
|
||||||
<link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic' type='text/css'>
|
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic" type="text/css" />
|
||||||
<link rel="stylesheet" href="style/ugc.css" type="text/css" />
|
<link rel="stylesheet" href="style/ugc.css" type="text/css" />
|
||||||
<script type="text/javascript" src="script/jquery.js"></script>
|
<script type="text/javascript" src="script/jquery.js"></script>
|
||||||
<script type="text/javascript" src="script/ugc.js"></script>
|
<script type="text/javascript" src="script/ugc.js"></script>
|
||||||
|
|||||||
@@ -103,7 +103,12 @@ function Film(oSettings)
|
|||||||
this._anchor = $('<div>', {'class':'film', 'id':'film_'+this.id()})
|
this._anchor = $('<div>', {'class':'film', 'id':'film_'+this.id()})
|
||||||
.data('id', this.id())
|
.data('id', this.id())
|
||||||
.append($('<img>', {'class':'bg', 'src':this.backgroundPoster()}))
|
.append($('<img>', {'class':'bg', 'src':this.backgroundPoster()}))
|
||||||
.append($('<div>', {'class':'poster-container'}).append($('<img>', {'class':'poster', 'src':this.backgroundPoster()})))
|
.append($('<div>', {'class':'poster-container'})
|
||||||
|
.append($('<img>', {'class':'poster', 'src':this.backgroundPoster()})
|
||||||
|
.click(function(){
|
||||||
|
$This = $(this);
|
||||||
|
$This.attr('src', $This.attr('src')+'&data[force]=1');
|
||||||
|
})))
|
||||||
.append($('<div>', {'class':'info'})
|
.append($('<div>', {'class':'info'})
|
||||||
.append($('<p>', {'class':'title'})
|
.append($('<p>', {'class':'title'})
|
||||||
.append($('<a>', {'class':'name', 'target':'_blank', 'href':this.consts.ugc_url+'film.html?id='+this.id()})
|
.append($('<a>', {'class':'name', 'target':'_blank', 'href':this.consts.ugc_url+'film.html?id='+this.id()})
|
||||||
|
|||||||
BIN
tmp/11000_medium.jpeg
Normal file
BIN
tmp/11000_medium.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Reference in New Issue
Block a user