예제 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $producto = new Producto($request->all());
     $this->validate($request, ['nombre' => 'required|min:5|max:50|unique:productos,nombre', 'codigo' => 'required|max:30|unique:productos,codigo', 'categoria_id' => 'required', 'subcategoria_id' => 'required']);
     $producto->save();
     if ($request->file('imagen')) {
         $file = $request->file('imagen');
         $name = 'producto_' . time() . '.' . $file->getClientOriginalExtension();
         //public_path() hace referencia a la carpeta public, pero en el hosting hay uqe cambiarlo, estoy se hace con una
         //funcion uqe se encuentra en el archivo index.php uqe esta en la carpeta public en el hosting
         $path = public_path() . '/images/productos/';
         $file->move($path, $name);
         $imagen = new Imagen();
         $imagen->nombre = $name;
         $imagen->producto_id = $producto->id;
         $imagen->save();
     } else {
         $imagen = new Imagen();
         $imagen->nombre = "sin_imagen.jpg";
         $imagen->producto_id = $producto->id;
         $imagen->save();
     }
     Flash::success('Producto ' . $producto->name . ' registrada exitosamente!!');
     return redirect()->route('admin.productos.index');
 }
예제 #2
0
 function Display()
 {
     $contenidoTpl = $this->_loadTemplate();
     $contenido = "";
     $contenido_extra = "";
     if ($this->img_path != "") {
         $img = new Imagen($this->img_path);
         $contenidoTpl = str_replace("#IMG-PROF#", $img->Display(), $contenidoTpl);
     } else {
         $contenidoTpl = str_replace("#IMG-PROF#", "", $contenidoTpl);
     }
     if ($this->extra_class != null) {
         $contenidoTpl = str_replace("#EXTRA-CLASS#", $this->extra_class, $contenidoTpl);
     } else {
         $contenidoTpl = str_replace("#EXTRA-CLASS#", "", $contenidoTpl);
     }
     if ($this->link != null) {
         $contenido = $this->link->Display() . "<br/>";
     }
     $contenido .= $this->txt;
     if ($this->extra_contenido != null) {
         $contenido_extra = $this->extra_contenido;
     }
     if ($this->foot != null) {
         $contenido .= "<br/>" . $this->foot->Display();
     }
     $contenidoTpl = str_replace("#CONTENIDO#", $contenido, $contenidoTpl);
     $contenidoTpl = str_replace("#EXTRA-CONTENIDO#", $contenido_extra, $contenidoTpl);
     return $contenidoTpl;
 }
예제 #3
0
function listar()
{
    require "../models/imagen.php";
    $img = new Imagen();
    if ($imagenes = $img->getAll()) {
        sendResponse(array("error" => false, "mensaje" => "", "data" => $imagenes));
    } else {
        sendResponse(array("error" => true, "mensaje" => "Error al obtener imágenes"));
    }
}
예제 #4
0
 function getRutas(User $user)
 {
     $autor = $user->getEmail();
     $this->bd->select($this->tabla, "*", "autor='{$autor}'", array(), "nombre, autor");
     $r = array();
     while ($fila = $this->bd->getRow()) {
         $imagen = new Imagen();
         $imagen->set($fila);
         $r[] = $imagen->getRuta();
     }
     return $r;
 }
예제 #5
0
 public static function editar($input)
 {
     $respuesta = array();
     $reglas = array('id' => array('required'));
     $validator = Validator::make($input, $reglas);
     if ($validator->fails()) {
         $respuesta['mensaje'] = $validator;
         $respuesta['error'] = true;
     } else {
         $galeria = Galeria::find($input['id']);
         if (isset($input['imagenes_existentes']) && $input['imagenes_existentes'] != "") {
             foreach ($input['imagenes_existentes'] as $key => $imagen) {
                 if ($imagen != "") {
                     $data_imagen = array('id' => $imagen, 'epigrafe' => $input['epigrafes_existentes'][$key]);
                     $imagen_creada = Imagen::editar($data_imagen);
                 }
             }
         }
         $data_item = array('id' => $galeria->item_id, 'titulo' => $input['titulo'], 'descripcion' => $input['descripcion'], 'file' => $input['file'], 'epigrafe' => $input['epigrafe']);
         $item = Item::editarItem($data_item);
         $respuesta['mensaje'] = 'Galeria modificada.';
         $respuesta['error'] = false;
         $respuesta['data'] = $item['data'];
     }
     return $respuesta;
 }
예제 #6
0
 public function actionDeleteImagen()
 {
     $Us = Usuario::model()->findByPk(Yii::app()->user->id);
     $id = $_POST['id'];
     $imagen = Imagen::model()->find('id_imagen=:id_imagen and id_usuario=:id_usuario', array(':id_usuario' => $Us->id_usuario, ':id_imagen' => $id));
     if ($id != null && $id != "") {
         $imagen->delete();
     }
 }
 public function ordenar()
 {
     foreach (Input::get('orden') as $key => $imagen_id) {
         if ($key == 0) {
             $destacado = 'A';
         } else {
             $destacado = NULL;
         }
         $respuesta = Imagen::ordenarImagenItem($imagen_id, $key, Input::get('item_id'), $destacado);
     }
     $item = Item::find(Input::get('item_id'));
     $menu = $item->seccionItem()->menuSeccion()->modulo()->nombre;
     return Redirect::to('/' . $menu . '/' . $item->lang()->url)->with('mensaje', $respuesta['mensaje'])->with('ok', true);
 }
예제 #8
0
 function Display()
 {
     $html = $this->_loadTemplate();
     $codigo_interior = "";
     foreach ($this->contenido as $comp) {
         $codigo_interior .= is_object($comp) ? $comp->Display() : $comp;
     }
     if ($this->is_new) {
         $imgNew = new Imagen(IMAGEN_NEW, TITLE_NEW);
         $codigo_interior .= $imgNew->Display();
     }
     if ($this->is_hot) {
         $imgHot = new Imagen(IMAGEN_HOT, TITLE_HOT);
         $codigo_interior .= $imgHot->Display();
     }
     if ($this->is_hit) {
         $imgHit = new Imagen(IMAGEN_HIT, TITLE_HIT);
         $codigo_interior .= $imgHit->Display();
     }
     $codigo_interior .= $this->extra_text;
     $html = str_replace("#CONTENIDO#", $codigo_interior, $html);
     return $html;
 }
예제 #9
0
<div class="bs-component">
	<table class="table table-striped table-hover ">
		<tr>
			<th>Nro</th>
			<th>Imagen</th>
			<th>Carpeta</th>
			<th>
				<a href="#" onClick="abrirVentana('AddRuta.php')" class="btn btn-info">Agregar +</a>
				<a href="ListadoProyectos.php" class="btn btn-info">Listado de Proyectos</a>
			</th>

		</tr>
		<?php 
require "../models/Imagen.php";
$imagen = new Imagen();
$datos = $imagen->Mostrar($proyecto);
$i = 1;
while ($row = $datos->fetch_assoc()) {
    ?>
			<tr class="active">
				<td><?php 
    echo $i;
    ?>
</td>
				<td><?php 
    echo $row['ruta'];
    ?>
</td>
				<td><?php 
    echo $row['directorio'];
 /**
  * Eliminar una imagen d eun articulo
  * @return object
  */
 public function api_eliminar_imagen_segun_articulo_backend()
 {
     $sIdImagen = Input::get('id_imagen');
     $sIdArticulo = Input::get('id_articulo');
     $sArchivo = Input::get('sArchivo');
     $Imagen = new Imagen();
     $oResultado = $Imagen->Eliminar_imagen_segun_articulo($sIdImagen, $sIdArticulo, $sArchivo);
     $sRutaArchivo = public_path() . "/imagenes/articulos/" . $sArchivo;
     //echo "<pre>";
     //dd($sRutaArchivo);die;
     if ($oResultado[0]->exito_eliminar == 1) {
         if (is_readable($sRutaArchivo)) {
             unlink($sRutaArchivo);
         } else {
             echo "error";
         }
     }
     return Response::json(array('oResultado' => $oResultado));
 }
예제 #11
0
<?php

require "funciones.php";
$bd = new BaseDeDatos();
$bd->setConexion();
$cadena = new Cadena($_POST['ruta']);
$archivo = substr($cadena->limpiar(), 12);
// Elimino los 12 primeros caracteres que representan el C:\fakePath\ que no nos sirve
$imagen = new Imagen('', $archivo, '', '../temp/', '');
$imagen->eliminar();
// Asigno la ruta final con el nombre del archivo a eliminar y elimino el archivo
예제 #12
0
<?php

require "funciones.php";
$bd = new BaseDeDatos();
$bd->setConexion();
foreach ($_FILES as $key) {
    if ($key['error'] == UPLOAD_ERR_OK) {
        // Verificamos si se subio correctamente
        $cadena = new Cadena($key['name']);
        // Limpio el nombre con el objeto Cadena
        $cadena2 = new Cadena($key['tmp_name']);
        // Limpio el nombre temporal con el objeto Cadena
        $tamano = $key['size'] / 1000 . ' kb';
    } else {
        echo $key['error'];
    }
    // Si no se cargo mostramos el error
}
$imagen = new Imagen('', $cadena->limpiar(), $cadena2->limpiar(), '../photos/thumb_', $tamano);
$imagen->redimensionar(300, 150);
$imagen->setImagen('thumb');
?>
 
if (isset($_REQUEST['type'])) {
    $action = $_REQUEST['type'] . '_marca';
}
include_once 'include/imagen.php';
include_once 'include/campo.php';
include_once 'include/campo_codigo.php';
include_once 'include/campo_oculto.php';
include_once 'include/boton.php';
$campo_cod_orig = new CampoOculto('codigo-original', $registro[0]);
$campo_include = new CampoOculto('include', 'articulos');
$campo_action = new CampoOculto('action', $action);
$campo_cod = new CampoCodigo('codigo', $registro[0]);
$campo_des = new Campo('descripcion', $registro[1], 'Descripción:', 'text');
$campo_img = new Campo('imagen', $registro[2], 'Archivo de imagen:', 'file');
$boton = new Boton('aceptar', 'Aceptar');
$imagen = new Imagen($registro[2]);
?>

<h1><?php 
if (isset($_REQUEST['type'])) {
    if ($_REQUEST['type'] == 'alta') {
        print "Alta de marca";
    } elseif ($_REQUEST['type'] == 'clonar') {
        print "Clonaci&oacute;n de marca";
    } else {
        print "Edici&oacute;n de marca";
    }
} else {
    print "Edici&oacute;n de marca";
}
?>
예제 #14
0
<?php

require "funciones.php";
$bd = new BaseDeDatos();
$bd->setConexion();
$cadena = new Cadena($_FILES['fotoN']['name']);
// Limpio el nombre con el objeto Cadena
$cadena2 = new Cadena($_FILES['fotoN']['tmp_name']);
// Limpio el nombre temporal con el objeto Cadena
$tamano = $_FILES['fotoN']['size'] / 1000 . ' kb';
// Obtengo el tamaño de la imagen
$imagen = new Imagen('', $cadena->limpiar(), $cadena2->limpiar(), '../photos/thumb_', $tamano);
$imagen->redimensionar(200, 165);
$real_path = '../photos/thumb_' . $cadena->limpiar();
$fake_path = substr($real_path, 3);
echo $fake_path;
예제 #15
0
파일: Imagen.php 프로젝트: neslonso/Sintax
 /**
  * Superpone una imagen sobre la imagen tratada
  * @param  string $file ruta de la imagen a superponer
  * @param  float  $mWidth multiplicador de anchura de la imagen a superponer respecto al tamaño de la imagen. Default 0.5.
  * @param  float  $mHeight multiplicador de altura de la imagen a superponer respecto al tamaño de la imagen. Default 0.5.
  * @param  string $position Dos palabras que indican alineación horizontal (left | right | center) y vertical (top | bottom | center)
  */
 public function superponer($file, $mWidth = 0.5, $mHeight = 0.5, $position = "center bottom")
 {
     $objImgMarca = Imagen::fromFile($file);
     $objImgMarca->fill($this->width() * $mWidth, $this->height() * $mHeight);
     $arrPos = explode(' ', $position);
     switch (count($arrPos)) {
         case '1':
             $hPos = $arrPos[0];
             $vPos = $arrPos[0];
             break;
         case '2':
             $hPos = $arrPos[0];
             $vPos = $arrPos[1];
             break;
         default:
             $hPos = "center";
             $vPos = "center";
     }
     switch ($hPos) {
         case 'left':
             $xDest = 0;
             break;
         case 'right':
             $xDest = $this->width() - $objImgMarca->width();
             break;
         default:
             //center
             $xDest = $this->width() / 2 - $objImgMarca->width() / 2;
     }
     switch ($vPos) {
         case 'top':
             $yDest = 0;
             break;
         case 'bottom':
             $yDest = $this->height() - $objImgMarca->height();
             break;
         default:
             //center
             $yDest = $this->height() / 2 - $objImgMarca->height() / 2;
     }
     imagecopy($this->imgData, $objImgMarca->imgData, $xDest, $yDest, 0, 0, $objImgMarca->width(), $objImgMarca->height());
 }
예제 #16
0
 public function lang()
 {
     $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first();
     $imagen = Imagen::join('imagen_lang', 'imagen_lang.imagen_id', '=', 'imagen.id')->where('imagen_lang.lang_id', $lang->id)->where('imagen_lang.estado', 'A')->where('imagen.id', $this->id)->first();
     if (is_null($imagen)) {
         echo "Por null";
         $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first();
         $imagen = Imagen::join('imagen_lang', 'imagen_lang.imagen_id', '=', 'imagen.id')->where('imagen_lang.lang_id', $lang->id)->where('imagen_lang.estado', 'A')->where('imagen.id', $this->id)->first();
     }
     return $imagen;
 }
예제 #17
0
 public function pasarItemsIdioma()
 {
     $idiomas = Idioma::where('estado', 'A')->get();
     $items_sin_idioma = Item::where('estado', 'A')->whereNotIn('id', function ($q) {
         $q->select('item_id')->from('item_lang')->where('estado', 'A');
     })->orderBy('id', 'ASC')->get();
     foreach ($items_sin_idioma as $item_sin) {
         echo "ID: " . $item_sin->id . "<br>";
         echo "Titulo: " . $item_sin->titulo . "<br>";
         echo "Descripcion: " . $item_sin->descripcion . "<br>";
         echo "URL: " . $item_sin->url . "<br><br>";
         $datos_lang = array('titulo' => $item_sin->titulo, 'descripcion' => $item_sin->descripcion, 'url' => $item_sin->url, 'estado' => 'A', 'fecha_carga' => date("Y-m-d H:i:s"), 'usuario_id_carga' => 1);
         foreach ($idiomas as $idioma) {
             /*
              if ($idioma->codigo != Config::get('app.locale')) {
              $datos_lang['url'] = $idioma->codigo . "/" . $datos_lang['url'];
             }
             * 
             */
             $item_sin->idiomas()->attach($idioma->id, $datos_lang);
         }
     }
     $imagenes_sin_idioma = Imagen::where('estado', 'A')->whereNotIn('id', function ($q) {
         $q->select('imagen_id')->from('imagen_lang')->where('estado', 'A');
     })->orderBy('id', 'ASC')->get();
     /*
      echo "CANTIDAD IMG: " . count($imagenes_sin_idioma);
      foreach ($imagenes_sin_idioma as $img_sin) {
      $datos_lang = array(
      'epigrafe' => $img_sin->epigrafe,
      'estado' => 'A',
      'fecha_carga' => date("Y-m-d H:i:s"),
      'usuario_id_carga' => 1
      );
     
      echo "ID IMG: " . $img_sin->id . "<br>";
     
      foreach ($idiomas as $idioma) {
      echo "ID IDIOMA: " . $idioma->id . "<br>";
      $img_sin->idiomas()->attach($idioma->id, $datos_lang);
      echo "PASO <br>";
      }
      }
     
      echo "LISTO";
     * 
     */
     $productos_sin_idioma = Producto::whereIn('item_id', function ($p) {
         $p->select('id')->from('item')->where('estado', 'A');
     })->whereNotIn('id', function ($q) {
         $q->select('producto_id')->from('producto_lang');
     })->orderBy('id', 'ASC')->get();
     echo "CANT PROD: " . count($productos_sin_idioma);
     foreach ($productos_sin_idioma as $prod_sin) {
         echo "ID: " . $prod_sin->id . "<br>";
         echo "Cuerpo: " . $prod_sin->cuerpo . "<br><br>";
         $datos_lang = array('cuerpo' => $prod_sin->cuerpo);
         foreach ($idiomas as $idioma) {
             $prod_sin->idiomas()->attach($idioma->id, $datos_lang);
         }
     }
 }
예제 #18
0
파일: appApi.php 프로젝트: neslonso/Sintax
function M_SEG()
{
    $file = './binaries/imgs/lib/spacer.gif';
    $objImg = Imagen::fromFile($file);
    ob_clean();
    //limpiamos el buffer antes de mandar la imagen, no queremos nada más que la imagen
    header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 60 * 60 * 24 * 364));
    $ancho = NULL;
    $alto = NULL;
    $modo = Imagen::OUTPUT_MODE_SCALE;
    $formato = "gif";
    $objImg->output($ancho, $alto, $modo, $formato);
    $email = $_GET['email'];
    $token = $_GET['token'];
    $idEnvio = $_GET['id'];
    if ($token == md5('M_SEG' . $email)) {
        //el token coincide con el email/
        //Actualizamos la ultimaActividad del cliente O el campo ultimoCorreo del emailPublico
        //Y el campo seguimiento del resultado del envío
        //error_log("api token=email: ".$email);
        $objCli = new Cliente();
        if ($objCli->cargarPorEmail($email)) {
            $objCli->SETultimaActividad(date('YmdHis'));
            $objCli->grabar();
        }
        $objEmailPublico = new EmailPublico();
        if ($objEmailPublico->cargarPorEmail($email)) {
            $objEmailPublico->SETultimoCorreo(date('YmdHis'));
            $objEmailPublico->grabar();
        }
        if ($idEnvio != 0) {
            if (EnvioProgramado::existeId($idEnvio)) {
                $objEnvProg = new EnvioProgramado($idEnvio);
                $objEnvProgRsl = new EnvioProgramadoResultados();
                if ($objEnvProgRsl->cargarPorIdEnvioMasEmail($idEnvio, $email)) {
                    $objEnvProgRsl->SETseguimiento(date('YmdHis'));
                    $objEnvProgRsl->grabar();
                }
            } else {
                throw new ApiException("idEnvio (" . $idEnvio . ") no encontrado");
            }
        }
    }
}
예제 #19
0
include '/classes/Upload.php';
include '/classes/Imagen.php';
$titulo = $_POST["nombreProyecto"];
$descripcion = $_POST["descripcionPro"];
$idUsuario = $_POST["idUsuario"];
$pro = new Proyecto();
$pro->titulo = $titulo;
$pro->descripcion = $descripcion;
$pro->idUsuario = $idUsuario;
$pro->Agregar();
$nombre_imagen = "file";
$upload = new Upload('file', array('image/jpeg', 'image/png', 'image/gif'), 'img/', "" . $nombre_imagen . date("YmdHi"));
if ($upload->url != null) {
    $pro->Listar($idUsuario);
    $filaPro = $pro->Listado[0];
    $img = new Imagen();
    $img->idProyecto = $filaPro["idProyecto"];
    $img->url = $upload->url;
    $img->Agregar();
    $img->ListarPorProyecto($filaPro["idProyecto"], "DESC");
    $imgFila = $img->Listado[0];
    $pro->fotoPortada = $imgFila["idImagen"];
    $pro->idProyecto = $imgFila["idProyecto"];
    $pro->Modificar();
    echo 'Nuevo proyecto agregado exitosamente';
} else {
    echo 'No se pudo cargar la imagen';
}
echo '<a href="';
echo $router->generate("perfil", array("idUsuario" => $_SESSION['id'], "nombreUsuario" => $_SESSION['nombre']));
echo '"> Volver al Perfil</a>';
예제 #20
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Imagen $value A Imagen object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Imagen $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
예제 #21
0
 public function uploadFile()
 {
     $negocio = Negocio::find(Input::get('negocio_id'));
     $anioMes = strftime("%Y%m", strtotime($negocio->created_at));
     if (Input::hasFile('file')) {
         $file = Input::file('file');
         $extension = $file->getClientOriginalExtension();
         $name = $file->getClientOriginalName();
         $filename = md5(date("Ymdhis"));
         if ($extension == 'jpg' || $extension == 'png' || $extension == 'jpeg') {
             $SimplePath = checkPath($anioMes, $negocio->id, 3);
             // 3 = imagenes
             $path = public_path() . '/' . $SimplePath;
             $image = Image::make(Input::file('file')->getRealPath());
             $image->fit(1280, 480);
             //3x
             $filename3x = $filename . '@3x.' . $extension;
             $image->save($path . '/' . $filename3x);
             $image->fit(640, 240);
             //2x
             $filename2x = $filename . '@2x.' . $extension;
             $image->save($path . '/' . $filename2x);
             $image->fit(320, 120);
             //1x
             $filename1x = $filename . '.' . $extension;
             $image->save($path . '/' . $filename1x);
             $imagenNegocio = new Imagen();
             $imagenNegocio->imagen = $anioMes . '/' . $negocio->id . '/imagenes/' . $filename1x;
             $imagenNegocio->save();
             if ($negocio->imagenes()->save($imagenNegocio)) {
                 return Response::json(["response" => "ok", "img" => $anioMes . '/' . $negocio->id . '/imagenes/' . $filename1x]);
             } else {
                 return Response::json(["response" => "error"]);
             }
         }
     } else {
         return Response::json(["response" => "error"]);
     }
 }
예제 #22
0
파일: img.php 프로젝트: peterweck/catman
 * @copyright Copyright © 2010, Victor Sanchez (Juaniquillo).
 * @email juaniquillo@gmail.com
 * @website http://juaniquillo.com
 */
if (isset($_GET['source'])) {
    highlight_file(__FILE__);
    exit;
}
$imagen = $_GET['file'];
$tama_imag = getimagesize($imagen);
$ancho_img = $tama_imag[0];
$alto_img = $tama_imag[1];
//echo $ancho_img.' - '.$alto_img;exit;
include_once "include/PHPImagen.lib.php";
// Instanciamos la clase
$imagen = new Imagen($imagen);
// Redimension de la imagen. Los parámetros los
// recibimos de la URL. Por motivos de seguridad,
// Los tamaños máximos permitidos son de 500x500 px.
$nuevo_ancho = $_GET['ancho'] <= $ancho_img ? $_GET['ancho'] : null;
$nuevo_alto = $_GET['alto'] <= $alto_img ? $_GET['alto'] : null;
$cut = isset($_GET['cut']) ? true : false;
$imagen->resize($nuevo_ancho, $nuevo_alto, $cut);
//Por la URL recibiremos el parámetro download
if (isset($_GET['download'])) {
    $imagen->doDownload();
} else {
    $imagen->doPrint();
}
?>
 
예제 #23
0
			if(event.keyCode == 37){
				var spinner = new Spinner(opts).spin(tar); 
				$('#ventana_emergente').load('php/detalles_prod.php?id='+id_anterior);
			}else if(event.keyCode == 39){
				var spinner = new Spinner(opts).spin(tar); 
				$('#ventana_emergente').load('php/detalles_prod.php?id='+id_siguiente);
			}
		}
	});
</script>
<?php 
$query = mysql_query("SELECT id_imagen, id_prod FROM imagen, producto WHERE producto.id_prod = '{$_GET['id']}' AND imagen.id_imagen = producto.id_prod");
if (mysql_num_rows($query) > 0) {
    while ($row = mysql_fetch_array($query)) {
        $producto = new Producto($row['id_prod']);
        $imagen = new Imagen($row['id_imagen'], '', '', '', '');
        ?>
<input type="hidden" id="id_prod" value="<?php 
        echo $producto->getId();
        ?>
">
<label class="pulse">Pulse 'Esc' para salir</label>
	<div class="detailProducto">
		<div id="<?php 
        echo $producto->getId();
        ?>
" class="detailImgProducto" style="background-image: url(<?php 
        echo str_replace('../', '', $imagen->getImagen('imagen'));
        ?>
);">
			<img src="img/delete.png" class="tool eliminar">
예제 #24
0
    function Display()
    {
        global $msisdn;
        //Esto es chancho, lo sé... pido perdón... :(
        global $ua;
        global $db;
        if ($msisdn != "" || IDEAS == 1) {
            $contenidoTpl = $this->_loadTemplate();
            $url_descarga = $this->href_si;
            $html = str_replace("#RESPUESTASI#", $url_descarga, $contenidoTpl);
            if (IDEAS == 1) {
                //Para el caso de IDEAS, se debe obtener el ID del tipo de contenidos de WAZZUP en lugar del de Ideas
                $datos_ideas = obtenerDatosCont($db, $this->idCont);
                $tipo_ideas = $datos_ideas['tipo_ideas'];
                $this->tipo = $datos_ideas['tipo'];
            }
            //echo $this->tipo."..";
            if (soportaContenidoPorTipo($db, $ua, $this->tipo)) {
                if ($this->idCont != 0) {
                    $datos = obtenerDatosCompra($this->tipo, $this->idCont);
                    //Nuevo super-multi-loco sistema para obtener precio de los contenidos
                    $id_wap = obtenerIDInteraccionWap($db, NOMBRE_MCM, OPERADORA_MCM);
                    $pc = new BillingContenido($db, $this->idCont, $id_wap);
                    $pc->ProcesarWap();
                    $precio_contenido = $pc->ObtenerPrecio();
                    if ($precio_contenido == "") {
                        //Si no tenemos un precio seteado para el precio, lo buscamos como lo haciamos antes.
                        if (IDEAS == 1) {
                            $datos = obtenerDatosCompra($tipo_ideas, $this->idCont);
                        } else {
                            $datos = obtenerDatosCompra($this->tipo, $this->idCont);
                            if (TIGO_CO == 1) {
                                $oPrecio = new PreciosContenidos($db);
                                $precio_contenido = $oPrecio->devolverPrecio("tigo_co", $this->idCont);
                            } else {
                                $precio_contenido = $datos["precio"];
                            }
                        }
                    }
                    if ($datos['nombre_cont'] == "Juego" && !check_game_compat($db, $ua, $this->idCont)) {
                        $html = "Este contenido no est�� disponible para su m�vil.";
                    } else {
                        $datos_cont = obtenerDatosContenido(null, $this->idCont, $datos['nombre_cont'] == "Juego");
                        if ($datos_cont['screenshots'] && $this->show_preview) {
                            $imgPreview = new Imagen("getimage.php?path=http://www.wazzup.com.uy/" . $datos_cont['screenshots'], $datos_cont['nombre']);
                            $html = str_replace("#IMG_PREVIEW#", $imgPreview->Display(), $html);
                        } else {
                            $html = str_replace("#IMG_PREVIEW#", "", $html);
                        }
                        $html = str_replace("#NOMBRE_CONTENIDO#", $datos_cont['nombre'], $html);
                    }
                }
                $html = str_replace("#IMG_PREVIEW#", "", $html);
                $html = str_replace("#RESPUESTANO#", $this->href_no, $html);
                if (TIGO_CO == 1) {
                    $html = str_replace("#PRECIO#", $precio_contenido, $html);
                } else {
                    $version_wap = $this->_soportaXHTML() ? "xhtml" : "wml";
                    $precio = isset($datos["precio_{$version_wap}"]) ? $datos["precio_{$version_wap}"] : $datos['precio'];
                    $html = str_replace("#PRECIO#", $precio, $html);
                }
                $html = str_replace("#NOMBRETIPO#", $datos['nombre_cont'], $html);
            } else {
                $html = "Este contenido no est&#225; disponible para su m&#243;vil.";
            }
        } else {
            $html = <<<HTML
\t\t\t\tEl contenido no se puede descargar en este momento, por favor intentelo m&#225;s tarde
HTML;
        }
        return $html;
    }
예제 #25
0
파일: link.php 프로젝트: vallejos/samples
 function Display()
 {
     $html = $this->_loadTemplate();
     $html = str_replace("#HREF#", $this->href, $html);
     $html = str_replace("#CLASE#", $this->clase, $html);
     $html = str_replace("#CLASE#", "", $html);
     //Por si no le seteamos una clase
     $html_interior = "";
     if ($this->img) {
         switch ($this->img_pos) {
             case LEFT_SIDE:
                 $html_interior .= $this->img->Display();
                 $html_interior .= parent::Display();
                 break;
             case TOP_SIDE:
                 $html_interior .= $this->img->Display();
                 $html_interior .= "<br/>" . parent::Display();
                 break;
             case RIGHT_SIDE:
                 $html_interior .= parent::Display();
                 $html_interior .= $this->img->Display();
                 break;
             case BOTTOM_SIDE:
                 $html_interior .= parent::Display();
                 $html_interior .= "<br/>" . $this->img->Display();
                 break;
         }
     } else {
         $html_interior .= parent::Display();
     }
     $html = str_replace("#CONTENIDO#", $html_interior, $html);
     $html .= $this->extra_text;
     if ($this->is_new) {
         $imgNew = new Imagen(IMAGEN_NEW, TITLE_NEW);
         $html .= $imgNew->Display();
         if ($this->_soportaXHTML()) {
             $html .= "<div class=\"clear\" ></div>";
         } else {
             $html .= "<br/>";
         }
     }
     if ($this->is_hot) {
         $imgHot = new Imagen(IMAGEN_HOT, TITLE_HOT);
         $html .= $imgHot->Display();
         //if(!$this->_soportaXHTML()) {
         $html .= "<br/>";
         //}
     }
     if ($this->is_hit) {
         $imgHit = new Imagen(IMAGEN_HIT, TITLE_HIT);
         $html .= $imgHit->Display();
         if ($this->_soportaXHTML()) {
             $html .= "<div class=\"clear\" ></div>";
         } else {
             $html .= "<br/>";
         }
     }
     return $html;
 }
예제 #26
0
 public static function editarSlideHome($input)
 {
     $respuesta = array();
     //Se definen las reglas con las que se van a validar los datos..
     $reglas = array('slide_id' => array('required'));
     //Se realiza la validación
     $validator = Validator::make($input, $reglas);
     if ($validator->fails()) {
         //Si está todo mal, carga lo que corresponde en el mensaje.
         $respuesta['mensaje'] = $validator;
         $respuesta['error'] = true;
     } else {
         //Se cargan los datos necesarios para la creacion del Item
         $slide = Slide::find($input['slide_id']);
         $slide->fecha_modificacion = date("Y-m-d H:i:s");
         $slide->save();
         //Lo crea definitivamente
         if (isset($input['imagenes_slide']) && $input['imagenes_slide'] != "") {
             if (is_array($input['imagenes_slide'])) {
                 foreach ($input['imagenes_slide'] as $key => $imagen) {
                     if ($imagen != "") {
                         $imagen_creada = Imagen::agregarImagenAngularSlideHome($imagen, $input['epigrafe_slide'][$key]);
                         if (!$imagen_creada['error']) {
                             $info = array('estado' => 'A', 'fecha_carga' => date("Y-m-d H:i:s"), 'usuario_id_carga' => Auth::user()->id);
                             $slide->imagenes()->attach($imagen_creada['data']->id, $info);
                         }
                     }
                 }
             }
         }
         if (isset($input['imagen_slide_editar']) && $input['imagen_slide_editar'] != "") {
             if (is_array($input['imagen_slide_editar'])) {
                 foreach ($input['imagen_slide_editar'] as $key => $imagen) {
                     if ($imagen != "") {
                         $info = array('id' => $imagen, 'epigrafe' => $input['epigrafe_imagen_slide_editar'][$key]);
                         $imagen_creada = Imagen::editar($info);
                     }
                 }
             }
         }
         //Mensaje correspondiente a la agregacion exitosa
         $respuesta['mensaje'] = 'Slide modificado.';
         $respuesta['error'] = false;
         $respuesta['data'] = $slide;
     }
     return $respuesta;
 }
예제 #27
0
<?php

require "funciones.php";
$bd = new BaseDeDatos();
$bd->setConexion();
foreach ($_FILES as $key) {
    if ($key['error'] == UPLOAD_ERR_OK) {
        // Verificamos si se subio correctamente
        $cadena = new Cadena($key['name']);
        // Limpio el nombre con el objeto Cadena
        $cadena2 = new Cadena($key['tmp_name']);
        // Limpio el nombre temporal con el objeto Cadena
        $tamano = $key['size'] / 1000 . ' kb';
    } else {
        echo $key['error'];
    }
    // Si no se cargo mostramos el error
}
$imagen = new Imagen('', $cadena->limpiar(), $cadena2->limpiar(), '../photos/', $tamano);
$imagen->redimensionar(600, 600);
$imagen->setImagen('imagen');
?>
 
예제 #28
0
 */
//si se pide el source
if (isset($_GET['source'])) {
    highlight_file(__FILE__);
    exit;
}
//ruta de la imagen
$imagen = $_GET['imagen'];
//se busca el tamaño de la imagen
$tama_imag = getimagesize($imagen);
$ancho_img = $tama_imag[0];
$alto_img = $tama_imag[1];
//incluimos la librería
include_once "funcionalidades/PHPImagen.lib.php";
//Instanciamos la clase
$imagen = new Imagen($imagen);
//si el ancho es mayor a alcho real de la imagen el ancho sera el ancho real
$nuevo_ancho = $_GET['ancho'] <= $ancho_img ? $_GET['ancho'] : NULL;
//si el alto es mayor a alto real de la imagen el alto sera el ancho real
$nuevo_alto = $_GET['alto'] <= $alto_img ? $_GET['alto'] : NULL;
//si se desea croppear la imagen se especifica el cut
$cut = isset($_GET['cut']) ? true : false;
//Redimension de la imagen. Los parámetros
$imagen->resize($nuevo_ancho, $nuevo_alto, $cut);
// Aplicación de la marca de agua
if ($_GET['mark'] !== "false") {
    $imagen->watermark("imagenes/favicon2.png", -1, -1, false, 0);
}
//Si se pide que se baje la imagen
if (isset($_GET['download'])) {
    $imagen->doDownload();
예제 #29
0
파일: routes.php 프로젝트: pcerbino/brea
Route::get('bio', function () {
    $cita = Cita::orderBy('created_at', 'desc')->first();
    $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get();
    return View::make('bio', array('cita' => $cita, 'menu' => $menu, 'bio' => DB::table('bio')->orderBy('id', 'desc')->first()));
});
Route::get('/', function () {
    $cita = Cita::orderBy('created_at', 'desc')->first();
    $galerias = Galeria::with('imagenes')->where('estado', '=', 'Activa')->orderBy('order')->get();
    $video = Video::orderBy('id')->first();
    $audio = Audio::orderBy('id')->first();
    $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get();
    return View::make('index', array('cita' => $cita, 'galerias' => $galerias, 'menu' => $menu, 'audio' => $audio, 'video' => $video));
});
Route::get('/imagen/{name}/{id}', function ($name, $id) {
    $cita = Cita::orderBy('created_at', 'desc')->first();
    $imagen = Imagen::find($id);
    $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get();
    return View::make('imagen', array('cita' => $cita, 'imagen' => $imagen, 'menu' => $menu));
});
Route::get('/video/{name}/{id}', function ($name, $id) {
    $cita = Cita::orderBy('created_at', 'desc')->first();
    $video = Video::find($id);
    $menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get();
    return Redirect::to($video->video);
});
Route::get('/serie/{name}/{id}', function ($name, $id) {
    $cita = Cita::orderBy('created_at', 'desc')->first();
    $galeria = Galeria::find($id);
    if ($name == 'Videos') {
        $sql = "SELECT id, galeria_id, null as imagen, video, poster, null as audio, titulo, 'video' as tipo, descripcion, created_at FROM videos ORDER BY created_at desc";
    } else {
예제 #30
0
    function Display()
    {
        global $msisdn;
        //Esto es chancho, lo sé... pido perdón... :(
        global $ua;
        global $db;
        if ($msisdn != "" || IDEAS == 1) {
            $contenidoTpl = $this->_loadTemplate();
            /*
            if(!$this->force_si) {
            	$url_descarga = urlWapPushAncel($msisdn, $this->idCont, false, servicio3G(), $this->nombre_wap);
            } else {
            	$url_descarga = $this->href_si;
            }
            */
            $url_descarga = $this->href_si;
            $html = str_replace("#RESPUESTASI#", $url_descarga, $contenidoTpl);
            if (IDEAS == 1) {
                //Para el caso de IDEAS, se debe obtener el ID del tipo de contenidos de WAZZUP en lugar del de Ideas
                $datos_ideas = obtenerDatosCont($db, $this->idCont);
                $tipo_ideas = $datos_ideas['tipo_ideas'];
                $this->tipo = $datos_ideas['tipo'];
            }
            //echo $this->tipo."..";
            if (soportaContenidoPorTipo($db, $ua, $this->tipo)) {
                if ($this->idCont != 0) {
                    if (IDEAS == 1) {
                        $datos = obtenerDatosCompra($tipo_ideas, $this->idCont);
                    } else {
                        $datos = obtenerDatosCompra($this->tipo, $this->idCont);
                        if (TIGO_CO == 1) {
                            $oPrecio = new PreciosContenidos($db);
                            $precio_contenido = $oPrecio->devolverPrecio("tigo_co", $this->idCont);
                        } else {
                            $precio_contenido = $datos["precio"];
                        }
                    }
                    if ($datos['nombre_cont'] == "Juego" && !check_game_compat($db, $ua, $this->idCont)) {
                        $html = "Este contenido no es compatible con\t su móvil.";
                    } else {
                        $datos_cont = obtenerDatosContenido(null, $this->idCont, $datos['nombre_cont'] == "Juego");
                        if ($datos_cont['screenshots'] && $this->show_preview) {
                            $imgPreview = new Imagen("getimage.php?path=http://www.wazzup.com.uy/" . $datos_cont['screenshots'], $datos_cont['nombre']);
                            $html = str_replace("#IMG_PREVIEW#", $imgPreview->Display(), $html);
                        } else {
                            $html = str_replace("#IMG_PREVIEW#", "", $html);
                        }
                        $html = str_replace("#NOMBRE_CONTENIDO#", $datos_cont['nombre'], $html);
                    }
                }
                $html = str_replace("#IMG_PREVIEW#", "", $html);
                $html = str_replace("#RESPUESTANO#", $this->href_no, $html);
                if (TIGO_CO == 1) {
                    $html = str_replace("#PRECIO#", $precio_contenido, $html);
                } else {
                    $version_wap = $this->_soportaXHTML() ? "xhtml" : "wml";
                    $precio = isset($datos["precio_{$version_wap}"]) ? $datos["precio_{$version_wap}"] : $datos['precio'];
                    $html = str_replace("#PRECIO#", $precio, $html);
                }
                $html = str_replace("#NOMBRETIPO#", $datos['nombre_cont'], $html);
            } else {
                $html = "Este contenido no está disponible para su móvil.";
            }
        } else {
            $html = <<<HTML
\t\t\t\tEl contenido no se puede descargar en este momento, por favor intentelo más tarde
HTML;
        }
        return $html;
    }