var $method = 'inline';
var $page = false;
var $is_local = false;
+ var $size;
+
function get($s, $opts=array()) // determin what to serve!!!!
{
//if (!empty($_GET['_post'])) {
// return $this->post();
//}
-
+
+
+
$this->is_local = (!empty($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'localhost') ? true : false;
$this->as_mimetype = empty($_REQUEST['as']) ? '' : $_REQUEST['as'];
}
$img->limit(1);
if (!$img->find(true)) {
- die("HERE");
$this->imgErr("no images for that item: " . htmlspecialchars($id),$s);
}
$img = DB_DataObjecT::factory('Images');
if (!$id || !$img->get($id) || !$img->exists()) {
+ //print_r($img); die("HERE");
$this->imgErr("image has been removed or deleted.",$s);
}
}
function imgErr($reason,$path) {
- header('Location: ' . $this->rootURL . '/Pman/templates/images/file-broken.png?reason=' .
- urlencode($reason) .'&path='.urlencode($path));
+ header('Location: ' . $this->rootURL . '/Pman/templates/images/file-broken.png?reason=' . urlencode($reason) );
+ header('X-Error: ' . $reason . ':' . $path);
+ echo $reason . ':' . $path;
exit;
}
function serve($img)
{
+
$this->sessionState(0); // turn off session... - locking...
require_once 'File/Convert.php';
- if (!file_exists($img->getStoreName())) {
-// print_r($img);exit;
- header('Location: ' . $this->rootURL . '/Pman/templates/images/file-broken.png?reason=' .
- urlencode("Original file was missing : " . $img->getStoreName()));
-
+ if (!$img->exists()) {
+ $this->imgErr("serve = missing-image", $img->getStoreName());
+
}
// print_r($img);exit;
$x = $img->toFileConvert();
if (empty($this->as_mimetype) || $img->mimetype == 'image/gif') {
$this->as_mimetype = $img->mimetype;
}
+
+
if (!$this->thumb) {
if ($x->mimetype == $this->as_mimetype) {
- $x->serveOnly($this->method);
+ $x->serveOnly($this->method, $img->filename);
exit;
}
$x->convert( $this->as_mimetype);
- $x->serve($this->method);
+ $x->serve($this->method, $img->filename);
exit;
}
//echo "SKALING? $this->size";
if (!file_exists($fn)) {
$this->validateSize();
}
+
if(!empty($this->page) && !is_nan($this->page * 1)){
$x->convert( $this->as_mimetype, $this->size, 0, $this->page);
}
}
+
+
+
+
}