{
$opts = HTML_FlexyFramework::get()->Pman;
$fn = preg_replace('/[^a-z0-9\.]+/i', '_', $this->filename);
- $opts = HTML_FlexyFramework::get()->Coba;
-
- print_r($opts);exit;
return implode( '/', array(
$opts['storedir'], '_images_', date('Y/m', strtotime($this->created)), $this->id . '-'. $fn
));
*/
function beforeDelete()
{
+
+ $opts = HTML_FlexyFramework::get()->Pman;
+ $deldir = $opts['storedir']. '/_deleted_images_';
+ if (!file_exists( $deldir )) {
+ mkdir($dir, 0755);
+ }
+
$fn = $this->getStoreName();
+ $b = basename($fn);
if (file_exists($fn)) {
- unlink($fn);
+
+ if (file_exists($deldir . '/'. $b)) {
+ unlink($fn);
+ } else {
+ rename($fn, $deldir .'/',$b);
+ }
+
+
}
// delete thumbs..
- $b = basename($fn);
+
$d = dirname($fn);
if (file_exists($d)) {
$dh = opendir($d);
while (false !== ($fn = readdir($dh))) {
if (substr($fn, 0, strlen($b)) == $b) {
- unlink($d. '/'. $fn);
+
+ if (file_exists($deldir . '/'. $fn)) {
+ unlink($d. '/'. $fn);
+ continue;
+ }
+ rename($d. '/'. $fn, $deldir .'/',$fn);
+
+
}
}
}