protected function saveImage($url)
 {
     $id = direct::fragment(2, $url);
     $ext = file::getExtension($url);
     $title = md5(uniqid()) . ".{$ext}";
     $i = new image();
     $file = $i->getFile($id);
     if (empty($file)) {
         return '';
     }
     $path = "/images/{$id}/{$title}";
     $save_path = conf::getFullFilesPath($path);
     $web_path = conf::getWebFilesPath($path);
     $dir = dirname($path);
     file::mkdir($dir);
     file_put_contents($save_path, $file['file']);
     return $web_path;
 }
 /**
  * Check to see if a image is a figure.
  * @param string $type (mp4 or image type)
  * @param string $url
  * @return false|string $res
  */
 public function isFigure($type, $url)
 {
     // Movie is always a reference.
     if ($type == 'mp4') {
         return $url;
     }
     // Image.
     if ($type != 'mp4') {
         // Check if image is a figure.
         $a = parse_url($url);
         //Off-site image. Not a figure
         if (isset($a['scheme'])) {
             return false;
         }
         $mod = direct::fragment(0, $url);
         if ($mod == 'image') {
             $id = direct::fragment(2, $url);
             $i = new imageModule();
             $row = $i->getSingleFileInfo($id);
             if ($row['figure'] == 1) {
                 return $row;
             }
         }
         return false;
     }
 }