mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-18 22:18:00 +00:00
preparations for dynamic data directories
This commit is contained in:
@@ -84,12 +84,12 @@ class ImageController implements ContentController
|
||||
|
||||
storeFile($tmpfile,$hash,true);
|
||||
|
||||
return array('status'=>'ok','hash'=>$hash,'url'=>URL.$hash);
|
||||
return array('status'=>'ok','hash'=>$hash,'url'=>getURL().$hash);
|
||||
}
|
||||
|
||||
public function handleHash($hash,$url)
|
||||
{
|
||||
$path = ROOT.DS.'data'.DS.$hash.DS.$hash;
|
||||
$path = getDataDir().DS.$hash.DS.$hash;
|
||||
$type = getExtensionOfFilename($hash);
|
||||
|
||||
//get all our sub files where all the good functions lie
|
||||
@@ -142,7 +142,7 @@ class ImageController implements ContentController
|
||||
//so if we take all parameters in key=>value form and hash it
|
||||
//we get one nice little hash for every eventuality
|
||||
$modhash = md5(http_build_query($modifiers,'',','));
|
||||
$newpath = ROOT.DS.'data'.DS.$hash.DS.$modhash.'_'.$hash;
|
||||
$newpath = getDataDir().DS.$hash.DS.$modhash.'_'.$hash;
|
||||
$im = $this->getObjOfImage($path);
|
||||
$f = new Filter();
|
||||
|
||||
@@ -174,7 +174,7 @@ class ImageController implements ContentController
|
||||
break;
|
||||
|
||||
case 'mp4':
|
||||
$mp4path = ROOT.DS.'data'.DS.$hash.DS.$hash.'mp4';
|
||||
$mp4path = getDataDir().DS.$hash.DS.$hash.'mp4';
|
||||
if(!file_exists($mp4path))
|
||||
$this->gifToMP4($path,$mp4path);
|
||||
$path = $mp4path;
|
||||
|
||||
@@ -9,7 +9,7 @@ class PlaceholderController implements ContentController
|
||||
|
||||
public function handleHash($hash,$url)
|
||||
{
|
||||
$path = ROOT.DS.'data'.DS.$hash.DS.$hash;
|
||||
$path = getDataDir().DS.$hash.DS.$hash;
|
||||
|
||||
include_once(dirname(__FILE__).DS.'placeholdergenerator.php');
|
||||
$pg = new PlaceholderGenerator();
|
||||
|
||||
@@ -9,7 +9,7 @@ class TextController implements ContentController
|
||||
|
||||
public function handleHash($hash,$url)
|
||||
{
|
||||
$path = ROOT.DS.'data'.DS.$hash.DS.$hash;
|
||||
$path = getDataDir().DS.$hash.DS.$hash;
|
||||
|
||||
if(in_array('raw',$url))
|
||||
{
|
||||
@@ -50,11 +50,11 @@ class TextController implements ContentController
|
||||
|
||||
storeFile($tmpfile,$hash,true);
|
||||
|
||||
return array('status'=>'ok','hash'=>$hash,'url'=>URL.$hash);
|
||||
return array('status'=>'ok','hash'=>$hash,'url'=>getURL().$hash);
|
||||
}
|
||||
|
||||
function getTypeOfText($hash)
|
||||
{
|
||||
return file_get_contents(ROOT.DS.'data'.DS.$hash.DS.'type');
|
||||
return file_get_contents(getDataDir().DS.$hash.DS.'type');
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ class VideoController implements ContentController
|
||||
|
||||
public function handleHash($hash,$url)
|
||||
{
|
||||
$path = ROOT.DS.'data'.DS.$hash.DS.$hash;
|
||||
$path = getDataDir().DS.$hash.DS.$hash;
|
||||
|
||||
//@todo: - resize by changing $path
|
||||
|
||||
@@ -21,7 +21,7 @@ class VideoController implements ContentController
|
||||
{
|
||||
$s = sizeStringToWidthHeight($size);
|
||||
$width = $s['width'];
|
||||
$newpath = ROOT.DS.'data'.DS.$hash.DS.$width.'_'.$hash;
|
||||
$newpath = getDataDir().DS.$hash.DS.$width.'_'.$hash;
|
||||
if(!file_exists($newpath))
|
||||
$this->resize($path,$newpath,$width);
|
||||
$path = $newpath;
|
||||
@@ -79,7 +79,7 @@ class VideoController implements ContentController
|
||||
if(!$this->rightEncodedMP4($file))
|
||||
system("nohup php ".ROOT.DS.'tools'.DS.'re-encode_mp4.php force '.$hash." > /dev/null 2> /dev/null &");
|
||||
|
||||
return array('status'=>'ok','hash'=>$hash,'url'=>URL.$hash);
|
||||
return array('status'=>'ok','hash'=>$hash,'url'=>getURL().$hash);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user