It looks like you're new here. If you want to get involved, click one of these buttons!
include_once(\"core/phmagick.php\");
$image_size = array(
'thumbs'=>array(150,150,'resizeExactly'),
'medium'=>array(450,450,'resize'),
'large'=>array(900,900,'resize')
);
//makeUrl(round(time()/rand(1,10)).\"_\".
$i=1;
foreach($image_size as $var=>$val)
{
//$val[2] = 'resizeExactly/resize',
//$val[0] width,
//$val[1] height
$phTargetPath = str_replace('//','/',$targetPath).\"/\".$var.\"/\".$filename
if(!is_dir($phTargetPath))
{
mkdir($phTargetPath,0775);
}
//echo Pre(\"IMAGE SHOULD BE UPLOADED TO \".$filename.\"<br>\");
${'phMagick'.$i} = new phMagick($tempFile,$phTargetPath);
${'phMagick'.$i}->$val[2]($val[0],$val[1]);
$i++;
}
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$filename = $_FILES['Filedata']['name'];
$targetFile = str_replace('//','/',$targetPath) . $filename;
//Avoid files Overwrite
while(file_exists($targetFile)){
$user = \"g\".rand(0,100);
$filename = $user.\"-\". $_FILES['Filedata']['name'];
$targetFile = str_replace('//','/',$targetPath) . $filename;
}
move_uploaded_file($tempFile,$targetFile);
include_once(\"core/phmagick.php\");
$image_size = array(
'thumbs'=>array(150,150,'resizeExactly'),
'medium'=>array(450,450,'resize'),
'large'=>array(900,900,'resize')
);
//makeUrl(round(time()/rand(1,10)).\"_\".
$i=1;
foreach($image_size as $var=>$val)
{
//$val[2] = 'resizeExactly/resize',
//$val[0] width,
//$val[1] height
$phTargetPath = str_replace('//','/',$targetPath).\"/\".$var.\"/\".$filename
if(!is_dir($phTargetPath))
{
mkdir($phTargetPath,0775);
}
//echo Pre(\"IMAGE SHOULD BE UPLOADED TO \".$filename.\"<br>\");
${'phMagick'.$i} = new phMagick($tempFile),$phTargetPath);
${'phMagick'.$i}->$val[2]($val[0],$val[1]);
$i++;
}
echo \"1\";
}
?>if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$filename = $_FILES['Filedata']['name'];
$targetFile = str_replace('//','/',$targetPath) . $filename;
//die(print_r($_REQUEST);
// $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
// $fileTypes = str_replace(';','|',$fileTypes);
// $typesArray = split('\|',$fileTypes);
// $fileParts = pathinfo($_FILES['Filedata']['name']);
//Avoid files Overwrite
while(file_exists($targetFile)){
$user = \"g\".rand(0,100);
$filename = $user.\"-\". $_FILES['Filedata']['name'];
$targetFile = str_replace('//','/',$targetPath) . $filename;
}
//if (in_array($fileParts['extension'],$typesArray)) {
// Uncomment the following line if you want to make the directory if it doesn't exist
mkdir(str_replace('//','/',$targetPath), 0775, true);
$image_size = array(
'thumbs'=>array(150,150),
'medium'=>array(450,450),
'large'=>array(900,900)
);
$i=1;
move_uploaded_file($tempFile,$targetFile);
foreach($image_size as $var=>$val)
{
${'p'.$i} = new phMagick();
$imageUrl = ${'p'.$i}->onTheFly($targetFile,$val[0],$val[1]);
//echo '<img alt=\"\" src=\"'.$imageUrl.'\">';
$i++;
}
if(exif_read_data($targetFile, 'IFD0'))
{
$exif = exif_read_data($targetFile, 'IFD0');
$exif = exif_read_data($targetFile, 0, true);
}
//getLocalTime returns the date and time in SQL DATETIME
//insert the information into the database
s::$db->insert('images',
array('path'=>$filename,
'cid'=>$_REQUEST['cid'],
'gid'=>$_REQUEST['gid'],
'uid'=>$_REQUEST['uid'],
'date_uploaded'=>getLocalTime(),
'date_taken'=>getLocalTime($exif[FILE][FileDateTime])
)
);
echo $filename;
// } else {
// echo 'Invalid file type.';
// }
}