Respuesta: Transpariencia de una Imagen con GD PROBLEMA Reitero las gracias por el interes.
Pongo el codigo que recibe los datos:
Recibiendo los datos, se guardan bien en la BD, pero la CLASE no funciona.
Si, para probar el buen funcionamiento de la clase, añado las lineas que estan comentadas, funciona bien.
Por esto mi perplejidad . . . . Código PHP: <?php
require("../phpsqlajax_dbinfo.php");
if (!$link) {die ("Error Conexion BD");}
// Get parameters from URL
$upfilename = $_POST['filetrack'];
$upfilesize = $_POST['upfilesize'];
$date = $_POST['date'];
$firstname = $_POST['firstname'];
$email = $_POST['email'];
$lastname = $_POST['lastname'];
$dist = $_POST['dist'];
$puntos = $_POST['puntos'];
$waypoints = $_POST['waypoints'];
$tiempo = $_POST['tiempo'];
$minima = $_POST['minima'];
$maxima = $_POST['maxima'];
$acumulado = $_POST['acumulado'];
$pictogram = $_POST['pictogram'];
$wptinicio_lat = $_POST['wptinicio_lat'];
$wptinicio_lng = $_POST['wptinicio_lng'];
$wptfinal_lat = $_POST['wptfinal_lat'];
$wptfinal_lng = $_POST['wptfinal_lng'];
$wptinicioutmx = $_POST['wptinicioutmx'];
$wptinicioutmy = $_POST['wptinicioutmy'];
$wptiniciozone = $_POST['wptiniciozone'];
$wptfinalutmx = $_POST['wptfinalutmx'];
$wptfinalutmy = $_POST['wptfinalutmy'];
$wptfinalzone = $_POST['wptfinalzone'];
$comment = $_POST['comment'];
$direccion = $_POST['direccion'];
$profile = $_POST['profile'];
// Evalua a true ya que $profile esta vacia
if (empty($profile)) {
echo '$profile, una variable vacia, o no esta definida en absoluto';
}
//$upfilename = "Untzueta2";
//$profile = "http://chart.apis.google.com/chart?cht=ls&chco=000000&chm=B,76A4FB,0,0,0&chd=s:ATSTaVd21981uocA&chf=bg,s,efefef&chtt=aia.gpx-9.44Km&chd=t:431.29,441.38,449.55,462.53,477.93,484.63,499.54,500.02,526.45,532.24,540.41,567.32,573.57,574.52,576.44,613.47,634.14,651.91,664.4,669.71,676.9,712.96,720.15,725.45,717.77,705.73,712.96,713.45,733.14,737.46,772.09,802.84,817.26,832.16,833.11,830.7,829.76,799.95,784.59,798.03,822.53,818.21,825.92,803.79,809.09,788.91,777.85,794.19,805.71,810.04,804.28,793.7,783.61,766.79,750.94,740.36,731.7,725.94,706.22,689.88,677.88,665.38,646.15,631.73,621.15,615.39,588.48,579.33,554.83,550.99,537.51,523.59,516.85,520.69,525.99,525.99,521.18,514.44,508.19,502.92,497.62,491.86,483.2,478.38,463.02,454.85,445.22,436.11,420.23,421.66,429.37,434.19,421.2,421.2,442.36,449.06,454.37,463.97,468.29,481.28,497.13,507.71,518.28,537.51,553.36,562.02,572.11,576.93,578.85,582.23,586.07,591.83,599.02,612.5,614.42,610.09,606.73,605.3,608.17,592.78,587.01,585.09,585.09,577.9,562.02,552.91,539.92,535.59,523.1,513.5,496.67,472.14,470.21,458.21,454.37,449.55,439.95,437.54,434.19,431.78,431.29,424.07&chg=20,50,1,5&chxt=x,y&chxr=0,1,9.44|1,0,833.11&chds=420.23,833.11&chs=800x250";
include 'class.image.transparency.php';
$transparency = new Image_Transparency;
// range of transparency (from 1 to 100)
$transparency->pct = 90;
// Source Image
echo $profile;
$transparency->source_image = $profile;
// New Image Name (optional)
$transparency->new_image_name = $upfilename;
// Save to folder (optional)
$transparency->save_to_folder = '../imagesProfile/';
$process = $transparency->make_transparent();
if($process['result'])
{
$profile = $process['new_file_path'];
}
if ($upfilename){
mysql_query ("INSERT INTO marcadores_tracks VALUES (null, '$upfilename', '$upfilesize', '$date', '$firstname', '$email', '$lastname', '$dist', '$puntos', '$waypoints', '$tiempo', '$minima', '$maxima', '$acumulado', '$pictogram', '$wptinicio_lat', '$wptinicio_lng', '$wptfinal_lat', '$wptfinal_lng', '$wptinicioutmx', '$wptinicioutmy', '$wptiniciozone', '$wptfinalutmx', '$wptfinalutmy', '$wptfinalzone', '$comment','$direccion','$profile','','','1')",$link);
mysql_query ("UPDATE marcadores_wpts SET validated = '1' WHERE upfilename = '$upfilename'",$link);
mysql_query ("UPDATE marcadores_fotos SET validated = '1' WHERE trackname = '$upfilename'",$link);
mysql_query ("UPDATE marcadores_links SET validated = '1' WHERE trackname = '$upfilename'",$link);
mysql_query ("UPDATE marcadores_trackspoints SET validated = '1' WHERE upfilename = '$upfilename'",$link);
//echo "'$upfilename', '$upfilesize', '$date', '$firstname', '$email', '$lastname', '$dist', '$puntos', '$waypoints', '$tiempo', '$minima', '$maxima', '$acumulado', '$pictogram', '$wptinicio_lat', '$wptinicio_lng', '$wptfinal_lat', '$wptfinal_lng', '$wptinicioutmx', '$wptinicioutmy', '$wptiniciozone', '$wptfinalutmx', '$wptfinalutmy', '$wptfinalzone', '$comment'";
$newupfilename = trim($upfilename);
$sql = "SELECT id FROM marcadores_tracks WHERE upfilename ='$newupfilename'";
$result = mysql_query($sql,$link);
$numrows = mysql_numrows($result);
if ($numrows) {
while ($row = @mysql_fetch_assoc($result)){
$id = $row['id'];
echo "<font color='indianred'>Ruta subida correctamente: </font><a href='modules.php?name=Mapas&op=Tracks&trackid=$id'> Pincha para ver el resutado <b> >>> $upfilename <<< </b></a><br><b>Puedes poner el mapa en tu WEB, Blog copiando este codigo:</b> <br>Mapa + Perfil (si el track dispone de altitudes) + Datos<br><input size='80' value=\"<iframe width='600px' height='850px' src='http://www.mendiak.net/modules/Mapas/Tracks/indexFrame.php?id=$id' frameBorder='0'></iframe>\"><br>Mapa + Perfil (si el track tiene altitudes) <br><input size='80' value=\"<iframe width='600px' height='550px' src='http://www.mendiak.net/modules/Mapas/Tracks/indexFrame2.php?id=$id' frameBorder='0'></iframe>\"><br>Solo el Mapa <br><input size='80' value=\"<iframe width='600px' height='450px' src='http://www.mendiak.net/modules/Mapas/Tracks/indexFrame3.php?id=$id' frameBorder='0'></iframe>\"><br>Tambien puedes subir otro archivo <a href='modules.php?name=Mapas&op=TracksUploads' target='_top'><font color='indianred'><b> << A Q U I M I S M O >> </b></font></a>";
}
}
}else{echo "Ha habido algun ERROR al subir la ruta. Intentalo de nuevo.";}
?> |