+ return $baseURL . $provider . "/$size/{$this->id}/{$shorten_name}"; // -- this breaks the rss feed #image-{$this->id}";
+ }
+
+ function getFromHashURL($url)
+ {
+ $id = false;
+ if (preg_match('/#image-([0-9]+)$/', $url, $matches)) {
+ $id = $matches[1];
+ } else if (preg_match('#Images/Thumb/[^/]+/([0-9]+)/#', $url, $matches)) {
+ $id = $matches[1];
+ } else if (preg_match('#Images/([0-9]+)/#', $url, $matches)) {
+ $id = $matches[1];
+ }
+
+ if ($id === false || $id < 1) {
+ return false;
+ }
+
+ $img = DB_DAtaObject::Factory('images');
+ if ($img->get($id)) {
+ return $img;
+ }
+ return false;
+ }
+
+
+ function shorten_name()
+ {
+ if(empty($this->filename)) {
+ return;
+ }
+
+ $filename = explode('.', $this->filename);
+ $ext = array_pop($filename);
+ $name = preg_replace("/[^A-Z0-9.]+/i", '-', implode('-', $filename)) ;
+
+ if(strlen($name) > 32) {
+ $name = substr($name, 0, 32);
+ }
+
+ $shorten_name = "{$name}.{$ext}";
+
+ return $shorten_name;