Init
This commit is contained in:
46
resize/resize.php
Normal file
46
resize/resize.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
ob_start();
|
||||
chdir('..');
|
||||
require_once ('api/Simpla.php');
|
||||
|
||||
$filename = $_GET['file'];
|
||||
$token = $_GET['token'];
|
||||
|
||||
$filename = str_replace('%2F', '/', $filename);
|
||||
|
||||
if(substr($filename, 0, 6) == 'http:/')
|
||||
$filename = 'http://'.substr($filename, 6);
|
||||
|
||||
$simpla = new Simpla();
|
||||
|
||||
//if (!$simpla->config->check_token($filename, $token))
|
||||
// exit('bad token');
|
||||
|
||||
$resized_filename = $simpla->image->resize($filename); //
|
||||
ob_end_clean();
|
||||
//echo '--'.$resized_filename;
|
||||
//if(is_readable($resized_filename))
|
||||
// header('Location: '.$_SERVER['REQUEST_URI']);
|
||||
|
||||
if (is_readable($resized_filename))
|
||||
{
|
||||
header('Content-type: image');
|
||||
print file_get_contents($resized_filename);
|
||||
}else{
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
header("Status: 404 Not Found");
|
||||
$_SERVER['REQUEST_URI'] = '/404/';
|
||||
|
||||
session_start();
|
||||
|
||||
require_once('view/IndexView.php');
|
||||
|
||||
$view = new IndexView();
|
||||
|
||||
$_GET['page_url'] = '404';
|
||||
$_GET['module'] = 'PageView';
|
||||
print $view->fetch();
|
||||
|
||||
//Header( "Location: /404/" );
|
||||
//exit;
|
||||
}
|
||||
151
resize/resize_brands.php
Normal file
151
resize/resize_brands.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
$width = 252;
|
||||
$height = 252;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$filename = $_GET['file'];
|
||||
$ext = mb_strtolower(substr(strrchr($filename, '.'), 1));
|
||||
if($ext != 'png'){
|
||||
chdir('..');
|
||||
require_once ('api/Simpla.php');
|
||||
//$token = $_GET['token'];
|
||||
$filename = str_replace('%2F', '/', $filename);
|
||||
|
||||
if (substr($filename, 0, 6) == 'http:/')
|
||||
$filename = 'http://' . substr($filename, 6);
|
||||
|
||||
$simpla = new Simpla();
|
||||
//if (!$simpla->config->check_token($filename, $token)){ exit('bad token'); }
|
||||
|
||||
$donefilename = $simpla->image->add_resize_params($filename, $width, $height, $set_watermark);
|
||||
|
||||
|
||||
|
||||
if (is_readable($simpla->config->categories_images_dir . $donefilename))
|
||||
{ $resized_filename = $simpla->config->categories_images_dir . $donefilename;}
|
||||
else
|
||||
{$resized_filename = $simpla->image->resizecat($filename);}
|
||||
|
||||
|
||||
///echo $resized_filename.'---88';
|
||||
///exit();
|
||||
|
||||
$resized_filename = ltrim($resized_filename,'/');
|
||||
|
||||
$name = substr($filename, 0, -strlen(strrchr ($filename, ".")));
|
||||
|
||||
if (is_readable($resized_filename))
|
||||
{
|
||||
header('Content-type: image');
|
||||
echo file_get_contents($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
exit;
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$filename = $_GET['file'];
|
||||
$ext = mb_strtolower(substr(strrchr($filename, '.'), 1));
|
||||
$name = substr($filename, 0, -strlen(strrchr ($filename, ".")));
|
||||
|
||||
$resized_filename = 'files/brands/'.$name.'.'.$width.'x'.$height.'.' . $ext;
|
||||
|
||||
if(file_exists($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename)) echoimg($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
|
||||
if($ext == 'png'){
|
||||
|
||||
if(!class_exists('SimpleImage')) include $_SERVER['DOCUMENT_ROOT'].'/api/SimpleImage.php';
|
||||
|
||||
$img = new SimpleImage($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
$img->best_fit($width, $height)->save($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename, 9);
|
||||
|
||||
echoimg($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$info = getimagesize($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
$default = 'h';
|
||||
$info = array(
|
||||
'width' => $info[0],
|
||||
'height' => $info[1],
|
||||
);
|
||||
|
||||
if($info['width'] < $width) echoimg($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
|
||||
if(file_exists($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename)) echoimg($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
|
||||
|
||||
$image = '';
|
||||
|
||||
if ($ext == 'gif') $image = imagecreatefromgif($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
if ($ext == 'png') $image = imagecreatefrompng($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
if(!$image) $image = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
|
||||
|
||||
|
||||
$xpos = 0;
|
||||
$ypos = 0;
|
||||
$scale = 1;
|
||||
|
||||
$scale_w = $width / $info['width'];
|
||||
$scale_h = $height / $info['height'];
|
||||
|
||||
if ($default == 'w') {
|
||||
$scale = $scale_w;
|
||||
} elseif ($default == 'h'){
|
||||
$scale = $scale_h;
|
||||
} else {
|
||||
$scale = min($scale_w, $scale_h);
|
||||
}
|
||||
|
||||
if ($scale == 1 && $scale_h == $scale_w) {
|
||||
echoimg($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
}
|
||||
|
||||
// $new_width = (int)($info['width'] * $scale);
|
||||
// $new_height = (int)($info['height'] * $scale);
|
||||
|
||||
$new_width = $width;
|
||||
$new_height = (int)($info['height']/($info['width']/$width));
|
||||
|
||||
//print_r($info); echo $new_height.'x'.$new_width; exit;
|
||||
|
||||
$xpos = (int)(($width - $new_width) / 2);
|
||||
$ypos = (int)(($height - $new_height) / 2);
|
||||
|
||||
$image_old = $image;
|
||||
$image = imagecreatetruecolor($width, $height);
|
||||
/*
|
||||
if ($ext == 'png') {
|
||||
imagealphablending($this->image, false);
|
||||
imagesavealpha($this->image, true);
|
||||
$background = imagecolorallocatealpha($this->image, 255, 255, 255, 127);
|
||||
imagecolortransparent($this->image, $background);
|
||||
} else {
|
||||
$background = imagecolorallocate($this->image, 255, 255, 255);
|
||||
}
|
||||
*/
|
||||
$background = imagecolorallocate($image, 28, 30, 44);
|
||||
imagefilledrectangle($image, 0, 0, $width, $height, $background);
|
||||
|
||||
imagecopyresampled($image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $info['width'], $info['height']);
|
||||
imagedestroy($image_old);
|
||||
imagejpeg($image, $_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename, 80);
|
||||
imagedestroy($image);
|
||||
|
||||
echoimg($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
|
||||
function echoimg($src){
|
||||
header('Content-type: image');
|
||||
echo file_get_contents($src);
|
||||
exit;
|
||||
}
|
||||
138
resize/resize_page_gallery.php
Normal file
138
resize/resize_page_gallery.php
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php
|
||||
|
||||
$width = 210;
|
||||
$height = 150;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$filename = $_GET['file'];
|
||||
$ext = mb_strtolower(substr(strrchr($filename, '.'), 1));
|
||||
if($ext != 'png'){
|
||||
chdir('..');
|
||||
require_once ('api/Simpla.php');
|
||||
//$token = $_GET['token'];
|
||||
$filename = str_replace('%2F', '/', $filename);
|
||||
|
||||
if (substr($filename, 0, 6) == 'http:/')
|
||||
$filename = 'http://' . substr($filename, 6);
|
||||
|
||||
$simpla = new Simpla();
|
||||
//if (!$simpla->config->check_token($filename, $token)){ exit('bad token'); }
|
||||
|
||||
$donefilename = $simpla->image->add_resize_params($filename, $width, $height, $set_watermark);
|
||||
|
||||
|
||||
|
||||
if (is_readable('' . $donefilename))
|
||||
{ $resized_filename = $simpla->config->categories_images_dir . $donefilename;}
|
||||
else
|
||||
{$resized_filename = $simpla->image->resizecat($filename);}
|
||||
|
||||
|
||||
///echo $resized_filename.'---88';
|
||||
///exit();
|
||||
|
||||
$resized_filename = ltrim($resized_filename,'/');
|
||||
|
||||
$name = substr($filename, 0, -strlen(strrchr ($filename, ".")));
|
||||
|
||||
if (is_readable($resized_filename) && $name != 'audi' && $name != 'dodge')
|
||||
{
|
||||
header('Content-type: image');
|
||||
echo file_get_contents($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
exit;
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$filename = $_GET['file'];
|
||||
$ext = mb_strtolower(substr(strrchr($filename, '.'), 1));
|
||||
$name = substr($filename, 0, -strlen(strrchr ($filename, ".")));
|
||||
|
||||
$resized_filename = 'files/categories/'.$name.'.'.$width.'x'.$height.'.jpg';
|
||||
|
||||
|
||||
|
||||
|
||||
$info = getimagesize($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
$default = 'h';
|
||||
$info = array(
|
||||
'width' => $info[0],
|
||||
'height' => $info[1],
|
||||
);
|
||||
|
||||
if($info['width'] < $width) echoimg($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
|
||||
if(file_exists($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename)) echoimg($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
|
||||
|
||||
$image = '';
|
||||
|
||||
if ($ext == 'gif') $image = imagecreatefromgif($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
if ($ext == 'png') $image = imagecreatefrompng($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
if(!$image) $image = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
|
||||
|
||||
|
||||
$xpos = 0;
|
||||
$ypos = 0;
|
||||
$scale = 1;
|
||||
|
||||
$scale_w = $width / $info['width'];
|
||||
$scale_h = $height / $info['height'];
|
||||
|
||||
if ($default == 'w') {
|
||||
$scale = $scale_w;
|
||||
} elseif ($default == 'h'){
|
||||
$scale = $scale_h;
|
||||
} else {
|
||||
$scale = min($scale_w, $scale_h);
|
||||
}
|
||||
|
||||
if ($scale == 1 && $scale_h == $scale_w) {
|
||||
echoimg($_SERVER['DOCUMENT_ROOT'].'/files/brands/'.$filename);
|
||||
}
|
||||
|
||||
// $new_width = (int)($info['width'] * $scale);
|
||||
// $new_height = (int)($info['height'] * $scale);
|
||||
|
||||
$new_width = $width;
|
||||
$new_height = (int)($info['height']/($info['width']/$width));
|
||||
|
||||
//print_r($info); echo $new_height.'x'.$new_width; exit;
|
||||
|
||||
$xpos = (int)(($width - $new_width) / 2);
|
||||
$ypos = (int)(($height - $new_height) / 2);
|
||||
|
||||
$image_old = $image;
|
||||
$image = imagecreatetruecolor($width, $height);
|
||||
/*
|
||||
if ($ext == 'png') {
|
||||
imagealphablending($this->image, false);
|
||||
imagesavealpha($this->image, true);
|
||||
$background = imagecolorallocatealpha($this->image, 255, 255, 255, 127);
|
||||
imagecolortransparent($this->image, $background);
|
||||
} else {
|
||||
$background = imagecolorallocate($this->image, 255, 255, 255);
|
||||
}
|
||||
*/
|
||||
$background = imagecolorallocate($image, 28, 30, 44);
|
||||
imagefilledrectangle($image, 0, 0, $width, $height, $background);
|
||||
|
||||
imagecopyresampled($image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $info['width'], $info['height']);
|
||||
imagedestroy($image_old);
|
||||
imagejpeg($image, $_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename, 80);
|
||||
imagedestroy($image);
|
||||
|
||||
echoimg($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
|
||||
function echoimg($src){
|
||||
header('Content-type: image');
|
||||
echo file_get_contents($src);
|
||||
exit;
|
||||
}
|
||||
198
resize/resizecat.php
Normal file
198
resize/resizecat.php
Normal file
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
chdir('..');
|
||||
require_once ('api/Simpla.php');
|
||||
|
||||
$width = isset($_GET['w']) ? $_GET['w'] : 241;
|
||||
$height = isset($_GET['h']) ? $_GET['h'] : 160;
|
||||
$crop = isset($_GET['cr']) ? (int)$_GET['cr'] : 1;
|
||||
$filename = 'files/categories/' . $_GET['file'];
|
||||
$filename = str_replace('%2F', '/', $filename);
|
||||
//die($filename);
|
||||
//if(isset($_GET['cr'])){
|
||||
|
||||
$file = Img::get($filename, array('width' => $width, 'height' => $height, 'crop' => $crop));
|
||||
|
||||
header('Content-type: image');
|
||||
echo file_get_contents($_SERVER['DOCUMENT_ROOT'] . $file);
|
||||
exit;
|
||||
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//die($filename);
|
||||
|
||||
|
||||
|
||||
$ext = mb_strtolower(substr(strrchr($filename, '.'), 1));
|
||||
if($ext != 'png'){
|
||||
|
||||
|
||||
//$token = $_GET['token'];
|
||||
$filename = str_replace('%2F', '/', $filename);
|
||||
|
||||
if (substr($filename, 0, 6) == 'http:/')
|
||||
$filename = 'http://' . substr($filename, 6);
|
||||
|
||||
$simpla = new Simpla();
|
||||
//if (!$simpla->config->check_token($filename, $token)){ exit('bad token'); }
|
||||
|
||||
$donefilename = $simpla->image->add_resize_params($filename, $width, $height, $set_watermark);
|
||||
|
||||
|
||||
|
||||
if (is_readable($simpla->config->categories_images_dir . $donefilename))
|
||||
{ $resized_filename = $simpla->config->categories_images_dir . $donefilename;}
|
||||
else
|
||||
{$resized_filename = $simpla->image->resizecat($filename);}
|
||||
|
||||
|
||||
///echo $resized_filename.'---88';
|
||||
///exit();
|
||||
|
||||
$resized_filename = ltrim($resized_filename,'/');
|
||||
|
||||
$name = substr($filename, 0, -strlen(strrchr ($filename, ".")));
|
||||
|
||||
if (is_readable($resized_filename) && $name != 'audi' && $name != 'dodge')
|
||||
{
|
||||
header('Content-type: image');
|
||||
echo file_get_contents($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
exit;
|
||||
}
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$filename = $_GET['file'];
|
||||
$ext = mb_strtolower(substr(strrchr($filename, '.'), 1));
|
||||
$name = substr($filename, 0, -strlen(strrchr ($filename, ".")));
|
||||
|
||||
$resized_filename = 'files/categories/'.$name.'.'.$width.'x'.$height.'.' . $ext;
|
||||
|
||||
if(file_exists($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename)) echoimg($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
|
||||
if($ext == 'png'){
|
||||
|
||||
if(!class_exists('SimpleImage')) include $_SERVER['DOCUMENT_ROOT'].'/api/SimpleImage.php';
|
||||
|
||||
$img = new SimpleImage($_SERVER['DOCUMENT_ROOT'].'/files/categories/'.$filename);
|
||||
$img->best_fit($width, $height)->save($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename, 9);
|
||||
|
||||
echoimg($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$info = getimagesize($_SERVER['DOCUMENT_ROOT'].'/files/categories/'.$filename);
|
||||
$default = 'h';
|
||||
$info = array(
|
||||
'width' => $info[0],
|
||||
'height' => $info[1],
|
||||
);
|
||||
|
||||
if($info['width'] < $width) echoimg($_SERVER['DOCUMENT_ROOT'].'/files/categories/'.$filename);
|
||||
|
||||
|
||||
|
||||
|
||||
$image = '';
|
||||
|
||||
if ($ext == 'gif') $image = imagecreatefromgif($_SERVER['DOCUMENT_ROOT'].'/files/categories/'.$filename);
|
||||
if ($ext == 'png') $image = imagecreatefrompng($_SERVER['DOCUMENT_ROOT'].'/files/categories/'.$filename);
|
||||
if(!$image) $image = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'].'/files/categories/'.$filename);
|
||||
|
||||
|
||||
|
||||
$xpos = 0;
|
||||
$ypos = 0;
|
||||
$scale = 1;
|
||||
|
||||
$scale_w = $width / $info['width'];
|
||||
$scale_h = $height / $info['height'];
|
||||
|
||||
if ($default == 'w') {
|
||||
$scale = $scale_w;
|
||||
} elseif ($default == 'h'){
|
||||
$scale = $scale_h;
|
||||
} else {
|
||||
$scale = min($scale_w, $scale_h);
|
||||
}
|
||||
|
||||
if ($scale == 1 && $scale_h == $scale_w) {
|
||||
echoimg($_SERVER['DOCUMENT_ROOT'].'/files/categories/'.$filename);
|
||||
}
|
||||
|
||||
// $new_width = (int)($info['width'] * $scale);
|
||||
// $new_height = (int)($info['height'] * $scale);
|
||||
|
||||
$new_width = $width;
|
||||
$new_height = (int)($info['height']/($info['width']/$width));
|
||||
|
||||
//print_r($info); echo $new_height.'x'.$new_width; exit;
|
||||
|
||||
$xpos = (int)(($width - $new_width) / 2);
|
||||
$ypos = (int)(($height - $new_height) / 2);
|
||||
|
||||
$image_old = $image;
|
||||
$image = imagecreatetruecolor($width, $height);
|
||||
/*
|
||||
if ($ext == 'png') {
|
||||
imagealphablending($this->image, false);
|
||||
imagesavealpha($this->image, true);
|
||||
$background = imagecolorallocatealpha($this->image, 255, 255, 255, 127);
|
||||
imagecolortransparent($this->image, $background);
|
||||
} else {
|
||||
$background = imagecolorallocate($this->image, 255, 255, 255);
|
||||
}
|
||||
*/
|
||||
|
||||
if($ext == 'png'){
|
||||
imagealphablending($image, false);
|
||||
imagesavealpha($image,true);
|
||||
|
||||
$transparent = imagecolorallocatealpha($new_image, 255, 255, 255, 127);
|
||||
imagefilledrectangle($image, 0, 0, $new_width, $new_height, $transparent);
|
||||
|
||||
imagecopyresampled($image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $info['width'], $info['height']);
|
||||
|
||||
imagealphablending($image, false);
|
||||
imagesavealpha($image,true);
|
||||
|
||||
imagepng($image, $_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename, 9);
|
||||
}else{
|
||||
|
||||
$background = imagecolorallocate($image, 28, 30, 44);
|
||||
imagefilledrectangle($image, 0, 0, $width, $height, $background);
|
||||
|
||||
imagecopyresampled($image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $info['width'], $info['height']);
|
||||
imagedestroy($image_old);
|
||||
imagejpeg($image, $_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename, 80);
|
||||
}
|
||||
imagedestroy($image);
|
||||
|
||||
echoimg($_SERVER['DOCUMENT_ROOT'].'/'.$resized_filename);
|
||||
|
||||
function echoimg($src){
|
||||
header('Content-type: image');
|
||||
echo file_get_contents($src);
|
||||
exit;
|
||||
}
|
||||
49
resize/resizepage.php
Normal file
49
resize/resizepage.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
chdir('..');
|
||||
require_once ('api/Simpla.php');
|
||||
|
||||
/*
|
||||
$width = isset($_GET['w']) ? $_GET['w'] : 241;
|
||||
$height = isset($_GET['h']) ? $_GET['h'] : 160;
|
||||
$crop = isset($_GET['cr']) ? (int)$_GET['cr'] : 1;
|
||||
$filename = 'files/categories/' . $_GET['file'];
|
||||
$filename = str_replace('%2F', '/', $filename);
|
||||
//print_r($_GET);die;
|
||||
if(isset($_GET['cr'])){
|
||||
|
||||
$file = Img::get($filename, array('width' => $width, 'height' => $height, 'crop' => $crop));
|
||||
|
||||
header('Content-type: image');
|
||||
echo file_get_contents($_SERVER['DOCUMENT_ROOT'] . $file);
|
||||
exit;
|
||||
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$filename = $_GET['file'];
|
||||
$token = $_GET['token'];
|
||||
$filename = str_replace('%2F', '/', $filename);
|
||||
|
||||
if (substr($filename, 0, 6) == 'http:/')
|
||||
$filename = 'http://' . substr($filename, 6);
|
||||
|
||||
$simpla = new Simpla();
|
||||
//if (!$simpla->config->check_token($filename, $token)) exit('bad token');
|
||||
|
||||
if (is_readable($simpla->config->page_images_dir . $filename))
|
||||
$resized_filename = $simpla->config->page_images_dir . $filename;
|
||||
else
|
||||
$resized_filename = $simpla->image->resizepage($filename);
|
||||
|
||||
if (is_readable($resized_filename))
|
||||
{
|
||||
header('Content-type: image');
|
||||
print file_get_contents($resized_filename);
|
||||
}
|
||||
29
resize/resizepost.php
Normal file
29
resize/resizepost.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
chdir('..');
|
||||
require_once ('api/Simpla.php');
|
||||
|
||||
$filename = $_GET['file'];
|
||||
$filename = str_replace('%3F', '?', $filename);
|
||||
|
||||
$filename = explode('?', $filename);
|
||||
$filename = $filename[0];
|
||||
|
||||
$token = $_GET['token'];
|
||||
$filename = str_replace('%2F', '/', $filename);
|
||||
|
||||
if (substr($filename, 0, 6) == 'http:/')
|
||||
$filename = 'http://' . substr($filename, 6);
|
||||
|
||||
$simpla = new Simpla();
|
||||
//if (!$simpla->config->check_token($filename, $token)) exit('bad token');
|
||||
|
||||
if (is_readable($simpla->config->post_images_dir . $filename))
|
||||
$resized_filename = $simpla->config->post_images_dir . $filename;
|
||||
else
|
||||
$resized_filename = $simpla->image->resizepost($filename);
|
||||
|
||||
if (is_readable($resized_filename))
|
||||
{
|
||||
header('Content-type: image');
|
||||
print file_get_contents($resized_filename);
|
||||
}
|
||||
Reference in New Issue
Block a user