Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/12/2014, 03:35
camilomascarell1987
 
Fecha de Ingreso: abril-2013
Mensajes: 39
Antigüedad: 11 años
Puntos: 0
php marca de agua img mysql

Buenas dias, yo si tengo mysql hay imagenes, pero php "marcas de agua images logo"
php es muy error
codigo
Código HTML:
<?php require_once('Connections/word.php'); ?>
<?php
$foto = $row_foto['imagenes'];
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_foto = "-1";
if (isset($_GET['id'])) {
  $colname_foto = $_GET['id'];
}
mysql_select_db($database_word, $word);
$query_foto = sprintf("SELECT * FROM fotogranfico WHERE id = %s", GetSQLValueString($colname_foto, "int"));
$foto = mysql_query($query_foto, $word) or die(mysql_error());
$row_foto = mysql_fetch_assoc($foto);
$totalRows_foto = mysql_num_rows($foto);
?>
<?php
// Cargar la estampa y la foto para aplicarle la marca de agua
$estampa = imagecreatefrompng('imagenes/logocandemasjor.png');
$im = imagecreatefromjpeg($foto);

// Establecer los márgenes para la estampa y obtener el alto/ancho de la imagen de la estampa
$margen_dcho = 10;
$margen_inf = 10;
$sx = imagesx($estampa);
$sy = imagesy($estampa);

// Copiar la imagen de la estampa sobre nuestra foto usando los índices de márgen y el
// ancho de la foto para calcular la posición de la estampa. 
imagecopy($im, $estampa, imagesx($im) - $sx - $margen_dcho, imagesy($im) - $sy - $margen_inf, 0, 0, imagesx($estampa), imagesy($estampa));

// Imprimir y liberar memoria
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
<?php
mysql_free_result($foto);
?>