
luismc2007
Members-
Posts
11 -
Joined
-
Last visited
luismc2007's Achievements

Newbie (1/5)
0
Reputation
-
OK. Thanks. How I mark this item as closed or finish?? I´m sorry but don´t know how to do it... thanks.
-
Hi. Yes, tonight I solve the problem... thanks. Now is other, but I´m going to investigate before post here. Thanks a lot for your help !!!!
-
Ok, perfect. I´ll try it. Thank you very much for your help... (php is a complicated mistery for me right now, i´m starting to program now...)
-
Oh, Dollar sign... jeje.. just forget it and don´t see it. :-) (sorry) now is ok... $escala_1=$ancho_final/$anchooriginal; $escala_2=$alto_final/$altooriginal; About the substr() function.... I think $final (first argument) is the "name" of the image that I create... or not? What I´m doing wrong with this? Thanks.
-
Hi. I just do that, I put that line at the beggining of the file and execute in the server.. no errors. :-) Maybe a clue. I receive this from an echo..... The thumb is: Resource ip.jpg Can be here the problem? HJow to fix? thanks.
-
Hi: Yes, this is the code and echos in english, sorry and thanks for everybody <?php if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br>"; } else { echo "File uploades: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Weight: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; } $archivo=$_SERVER['DOCUMENT_ROOT']."/test/arriba/".$_FILES["file"]["name"]; echo "The file is: $archivo<br>"; echo "Copying file in destiny<br>"; move_uploaded_file($_FILES["file"]["tmp_name"], $archivo); echo "Fichero imagen copiado<br>"; //Get the size of the original image list($ancho,$alto)=getimagesize($archivo); $anchooriginal=$ancho; echo "Original width: $anchooriginal<br>"; $altooriginal=$alto; echo "OriginalHeight: $altooriginal<br>"; // What is the image... $separo = explode( '.', strtolower($archivo) ); $nombre = $separo[0]; $extension = $separo[1]; echo "Name: $nombre<br>"; echo "Extension: $extension<br>"; //My Final size for thumb $ancho_final="200"; $alto_final="150"; // Create a new jpg image $imagen_src = imagecreatefromjpeg( $archivo ); echo "ok, new image created in jpg format<br>"; //scaling and calculating size of image $escala_1=1; $escala_2=1; $escala_1=$ancho_final/$anchooriginal; $escala_2=alto_final/$altooriginal; echo "New Sizes: $escala_1, $escala_2 <br>"; //Let see if vertical or horizontal if ( $altooriginal > $anchooriginal ) { $escala_1 = $escala_2; } echo"Ok, scaling complete vertical-horizontal<br>"; // scaling $horizontal=ceil( $anchooriginal * $escala_1 ); $vertical=ceil( $altooriginal * $escala_1 ); echo"The new scale is: $horizontal, $vertical<br>"; //create new image $final=imagecreatetruecolor ( $horizontal, $vertical ); echo"The new image is created<br>"; //copying the new image into teh new small image imagecopyresized ( $final, $imagen_src, 0, 0, 0, 0, $horizontal, $vertical, imagesx($imagen_src), imagesy($imagen_src) ); echo"Copied<br>"; $destinofinal=$_SERVER['DOCUMENT_ROOT']."/test/arriba/"; echo "Copying file into final destiny: $destinofinal<br>"; //The new name for thumb $cadenapeque="p.jpg"; $extraigo=substr($final,0,-4); $lapeque=$extraigo.$cadenapeque; echo "The thumb is: $lapeque<br>"; //creating imagejpeg($final,$lapeque); //The thumb that I want to copy and save in the server copy($lapeque, $destinofinal); echo "Image saved in destiny<br>"; echo"closing...<br>"; imagedestroy ($final); echo"END<br>"; ?> I think my error is around this comment line: //The thumb that I want to copy and save in the server Thanks.
-
Hi, good morning. I have this code attached that is almost finished ready to work... ( sorry, is coded in spanish language ) But, at the end I have an error and don´t know how to fix... I´m, trying to copy and save the new image created "$final" with a new name "$lapeque", but doesn´t work. ( At comment: //PASO LA IMAGEN CREADA PEQUEÑA Y LA GRABO EN LA CARPETA DESTINOFINAL ) This code is without errors and runs to the end "echo[FIN]". Any idea?? Can you help me? please. Thanks a lot. Regards resizer.php.
-
Perfect. Its running now. Thanks.!!
-
Hi: I´m trying to make my own code for upload images using php to my server for my webpage, but I don´t know why the code doesn´t work at 100%. I know that its works until a point but not more away... Can you help me?? I have two files: an html and php called "form.html" and "sube.php" that I post here... And now explain what I´m try to do... [ File: form.html ] <form action="sube.php" method="post" enctype="multipart/form-data"> Sube un archivo:<br /> <input type="file" name="archivo" id="archivo" /> <br /> <input type="submit" name="boton" value="Subir" /> </form> [ File: sube.php ] <?php echo "Name of image: ".$_FILES["archivo"]["name"]; echo "<br />"; $tamano = $_FILES["archivo"]["size"]; echo "Size of image: ".$_FILES["archivo"]["size"]; // here always an error echo "<br>"; $t_max="50000000000"; echo "Maximum size:"; echo "$t_max <br>"; if( $tamano < $t_max) { $destino = "fotogal/grandes"; $sep=explode('image/',$_FILES["archivo"]["type"]); if($_FILES["archivo"]["type"] == "gif" || $_FILES["archivo"]["type"] == "jpg" ) move_uploaded_file ( $_FILES["archivo"]["tmp_name"], $destino . '/' .$_FILES["archivo"]["name"]); } else echo "No way..."; // OUT } else { echo "too much weight of image."; } ?> The case of this is that always i reach the same point and don´t know how to go further... The point is that always I receive: Name.."ok"... Size: This item is completely different of the weight of the image And... No way. This is always my result. Can you help me with this code????? I would like to upload my own images, but I´m not able to do it... and don´t know why. Thanks a lot. regards
-
Hi: I´m trying to upload 2 files to the server and only one is ok. The second don´t give me error but don´t upload the file. I check that the first one is ok, but not the second... This is the code. Anyone can help me?? thanks. $fpeque=$_FILES['impeq']['name']; $fgrande=$_FILES['imgran']['name']; $arriba_peq="$DOCUMENT_ROOT/libros/"; $arriba_gran="$DOCUMENT_ROOT/libros/grandes/"; $im_p=$arriba_peq.$fpeque; $im_g=$arrriba_gran.$fgrande; // first one...sucess if (copy($_FILES['impeq']['tmp_name'], $im_p)) { echo"Foto Pequeña OK<br>"; } else { echo"Foto Pequeña ERROR<br>"; } //second... not error but not upload if(copy($_FILES['imgran']['tmp_name'], $im_g)) { echo"Foto grande OK<br>"; } else { echo"Foto grande ERROR<br>"; }
-
Hi: I made this code to try to get result on a database selection random on 3 different results. I want to get the result: ARTICLE1-ARTICLE2-ARTICLE3. Right now, I just have 1-1-1 How can I get this thing?? Thanks a lot for your help... <?php //--Dynamic module for 3 results // connection to database include ("conexion.php"); conecta(); //-- Consult database $sql="SELECT field1,field2,field3 FROM mytable ORDER BY RAND() Limit 3"; $result = mysql_query($sql) or die(mysql_error()); while ($fila=mysql_fetch_array($result)) { $one=$fila['field1']; $two=$fila['field2']; $three=$fila['field3']; echo"<tr>"; echo"<td align=center>"; echo"<P class=linea><strong>also this result:</strong></P>"; echo"<table border=0 width=630>"; echo"<tr>"; echo"<td align=center valign=top><a href=$two.html><img src=fotoarticulo/$three><br>"; echo"<P class=pequena><strong>one</strong></P></a></td>"; echo"<td align=center valign=top><a href=$two.html><img src=fotoarticulo/$three><br>"; echo"<P class=pequena><strong>$one</strong></P></a></td>"; echo"<td align=center valign=top><a href=$two><img src=fotoarticulo/$three><br>"; echo"<P class=pequena><strong>$one</strong></P></a></td>"; echo"</tr>"; echo"</table>"; echo"</td>"; echo"</tr>"; } //-- Close mysql_close(); ?> How can I made that my results are based on 3 random results from the database and printed in the table in order 1-2-3 (results)??? Please, help. Thanks. Regards