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"); } } } }
/** * 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()); }
$objImg = Imagen::fromFile($file); } break; default: try { if (defined($_GET['almacen'])) { $file = constant($_GET['almacen']) . $_GET['fichero']; } else { $file = BASE_IMGS_DIR . $_GET['fichero']; } $objImg = Imagen::fromFile($file); } catch (Exception $e) { //error_log(print_r($e,true)); error_log($e->getMessage()); $file = BASE_IMGS_DIR . 'imgErr.png'; $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 = isset($_GET['ancho']) && is_numeric($_GET['ancho']) ? $_GET['ancho'] : NULL; $alto = isset($_GET['alto']) && is_numeric($_GET['alto']) ? $_GET['alto'] : NULL; $modo = isset($_GET['modo']) && is_numeric($_GET['modo']) ? $_GET['modo'] : Imagen::OUTPUT_MODE_SCALE; $formato = isset($_GET['formato']) ? $_GET['formato'] : "png"; $objImg->output($ancho, $alto, $modo, $formato); } catch (Exception $e) { $firephp->info("Excepcion de tipo: " . get_class($e) . ". Mensaje: " . $e->getMessage() . " en fichero " . $e->getFile() . " en linea " . $e->getLine()); $firephp->info($e->getTrace(), "trace"); $firephp->info($e->getTraceAsString(), "traceAsString"); error_log("Excepcion de tipo: " . get_class($e) . ". Mensaje: " . $e->getMessage() . " en fichero " . $e->getFile() . " en linea " . $e->getLine());