Esempio n. 1
0
         $objImg = Imagen::fromFile($file);
     }
     break;
 case "DB":
     try {
         \cDb::conf(_DB_HOST_, _DB_USER_, _DB_PASSWD_, _DB_NAME_);
         $db = cDb::getInstance();
         list($tabla, $campoId, $valorId, $campoData) = explode('.', $_GET["fichero"]);
         $sql = "SELECT " . $campoId . ", " . $campoData . " FROM " . $tabla . " WHERE id='" . $db->real_Escape_String($valorId) . "'";
         //$GLOBALS['firephp']->info($sql);
         $rslSet = $db->query($sql);
         if ($rslSet->num_rows > 0) {
             $data = $rslSet->fetch_object();
             $data = $data->{$campoData};
         }
         $objImg = Imagen::fromString($data);
         //$objImg->marcaAgua("");
         //$objImg->marcaAgua("",1,1,"center");
     } catch (Exception $e) {
         error_log(print_r($e, true));
         $file = BASE_IMGS_DIR . 'imgErr.png';
         $objImg = Imagen::fromFile($file);
     }
     break;
 default:
     try {
         if (defined($_GET['almacen'])) {
             $file = constant($_GET['almacen']) . $_GET['fichero'];
         } else {
             $file = BASE_IMGS_DIR . $_GET['fichero'];
         }