$tn.filename LIKE '%{$this->escape($q['search']['filename'])}%' OR $tn.title LIKE '%{$this->escape($q['search']['filename'])}%'
");
}
+
+ if(!empty($q['_to_base64']) && !empty($q['image_id'])) {
+ $i = DB_DataObject::factory("Images");
+ $i->get($q['image_id']);
+ $roo->jok($i->toBase64());
+ }
}
$o = $this->object();
//print_r($o);
- if ($o && (method_exists($o, 'checkPerm')) {
+ if ($o && method_exists($o, 'checkPerm')) {
// edit permissions on related object needed...
return $o->checkPerm( $lvl == 'S' ? 'S' : 'E' , $au);
*
* @return - target file name
*/
- function getStoreName()
+ function getStoreName($alt = false)
{
$opts = HTML_FlexyFramework::get()->Pman;
- $fn = preg_replace('/[^a-z0-9\.]+/i', '_', $this->filename);
+ $fn = preg_replace('/[^a-z0-9_\.]+/i', '_', $this->filename);
+ if ($alt) {
+ $fn = preg_replace('/[^a-z0-9\.]+/i', '_', $this->filename);
+ }
return implode( '/', array(
$opts['storedir'], '_images_', date('Y/m', strtotime($this->created)), $this->id . '-'. $fn
));
*/
function exists()
{
+ clearstatcache();
+ //var_dump($this->getStoreName());
return file_exists($this->getStoreName());
}
}
- $ret['shorten_name'] = $ret['filename'] = $this->shorten_name();
+ $ret['shorten_name'] = $this->shorten_name();
return $ret;
}
*/
function toFileConvert()
{
+ $fn = $this->getStoreName();
+ if (!file_exists($fn)) {
+ $fn = $this->getStoreName(true);
+ }
+
require_once 'File/Convert.php';
$fc = new File_Convert($this->getStoreName(), $this->mimetype);
return $fc;
}
$file = $this->getStoreName();
-
+
if(!file_exists($file)){
return false;
}