Jump to content

uisneach

Members
  • Posts

    50
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

uisneach's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello EB I need to generate pages with php code. I have a form to enter title, text and with db my sql I recover the details on a page on my website <form enctype="multipart/form-data" action="articoli.php" method="POST"><br /> <h1 class="grigio">Sezione 1: nuovo articolo</h1><br /> Titolo &nbsp &nbsp &nbsp&nbsp &nbsp&nbsp<input type="text" name="titolo" value="" size="32"><br /> SottoTitolo &nbsp &nbsp<input type="text" name="sottotitolo" value="" size="32"><br /> <input type="hidden" name="MAX_FILE_SIZE" value="5000000"> Aggiungi un'immagine: <input name="userfile" type="file"> <textarea name="testo" rows="15" cols="80"> qui puoi scrivere il tuo testo </textarea> <input type="submit" value="invia"> </form> </div> Then here how tot insert to the DB the details (using the page articoli.php) $titolo = $_POST['titolo']; $sottotitolo = $_POST['sottotitolo']; $testo = $_POST['testo']; $description = "INSERT INTO curiosita (titolo,sottotitolo,testo) VALUES ('$titolo','$sottotitolo','$testo')"; //preparo la stringa per l'inserimento mysql_select_db($dbname); //effettuo l'inserimento sul database $Result1 = mysql_query($description) or die(mysql_error()); //effettuo l'inserimento sul database Later, I see it on a web page on my website, with a select function $nesql2 = "SELECT id,titolo,sottotitolo,testo FROM(SELECT id,titolo,sottotitolo,testo FROM curiosita ORDER by id DESC) a LIMIT 1"; $nentry2 = mysql_query ($nesql2); while ($new2 = mysql_fetch_row($nentry2)) { print $new2[1] ."</span><br>\n". $new2[2] . "</span><br>\n".$new2[3]; } } But this is only good to create everytime a new article. And anyone know or may suggest me how to -create an archive with links where to store automatically all the old articles? -create a template in php that give a new name to the new article using the title field.(this template i want to use everytime, i suppose it must be empty. How to fill it with the new data entered is my question. And how to generate a new html page with the new title?) thanks a lot in advance paolo
  2. Hello. I got this $sql = "SELECT * FROM notturna ORDER BY descrizione"; $result = mysql_query ($sql); while ($row = mysql_fetch_row($result)) { if ( $item == 0 ) { $_primafoto = $row[0]; } echo "photos[".$item."]=\"notturna/".$row[0].".jpg\";"; $item=$item+1; } } ?> function arrow() { document.getElementById( "back2" ).style.display = "none"; } function changePic(dir) { var image = document.images.photoslider, fwdBtn = document.getElementById('forward2'), backBtn = document.getElementById('back2'), n = photos.length-1; if (dir == "next") { which = (which < n) ? which + 1 : which; image.src = photos[which]; backBtn.style.display = "inline"; if (which == n) { fwdBtn.style.display = "none"; } } else if (dir == "back") { which = (which > 0) ? which - 1 : which; image.src = photos[which]; fwdBtn.style.display = "inline"; if (which === 0) { backBtn.style.display = "none"; } } return false; } </script> </head> <body OnLoad="arrow()"> <div class="container2"> <div id="logo" > <img title="logo" src="logo2.jpg"></div> <div class="menu"> <a href="http://paolobergomifoto.altervista.org">Home </a> <a href="http://paolobergomifoto.altervista.org">Chi sono </a> <a href="http://paolobergomifoto.altervista.org/gallerie.html">Gallerie </a> <a href="http://paolobergomifoto.altervista.org/contatti.html">Contatti </a> <a href="http://paolobergomifoto.altervista.org">Credits </a> </div> <div id="backnotturna"> <a href="#" onclick="return changePic('back');"> <img id="back2" style="border:0px" src="indietro.jpg"></a> </div> <div class="centro"> <div class="gruppofoto2"><a href="gallerymacro.php">Macro</a><a href="gallerypaesaggi.php">Paesaggi</a><a href="galleryritratti.php">Ritratti</a><a href="gallerybn.php">B&N</a><a href="gallerynotturna.php">Notturna</a><a href="galleryvarie.php">Varie</a><img src="notturna/<?php echo $_primafoto; ?>" name="photoslider"> </div> </div> <div id="forward"><a href="#" onclick="return changePic('next');"> <img id="forward2" style="border:0px" src="avanti.jpg"></a> </div> <div class="inizio"><a href="#" onclick="which=1; changePic('back');return false" >Torna all'inizio della gallery</a> </div> <div id="footer">Created by Paolo Bergomi</div> </div> The table in db has also a second field that in the query is represented by the variable $row[1] . this is the description of the pictures. I have an issue cause i don't know how to do to show the content of this field using the query above. The pictures is correctrly showed in the gallery, and my target is to add the relative description.(as i wrote, is the second field in the table) any idea ? cheers paolo
  3. sorry, it's ok now. Just need to tak out the width parameter in div.boxpicture class! ;D it's really a stupid thing, sorry.
  4. hello e.b. i got a issue with resizing script, the following i think all the parameters are correcet with this i got a fixe image very good as quality but i can only resize horizonatal pics list($width, $height, $type, $attr) = getimagesize($_SERVER['DOCUMENT_ROOT'].'public/foto/'.$ultimo_id.'.jpg'); // Creo la versione 120*90 dell'immagine (thumbnail) $thumb = imagecreatetruecolor(120, 90); $source = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'].'public/foto/'.$ultimo_id.'.jpg'); imagecopyresized($thumb, $source, 0, 0, 0, 0, 120, 90, $width, $height); // Salvo l'immagine ridimensionata imagejpeg($thumb, $_SERVER['DOCUMENT_ROOT']."public/foto/thumbnail/".$ultimo_id."_thumb.jpg", 75); WHIT THIS ONE, I GOT A RESIZE WRONG , NOT AS I WISH (100PIX VERTICAL) and with very bad quality for the images with height higher than width (vertical, of course) don't understand a.. ??? $imagehw=(list($width, $height,$attr,$type) = getimagesize("public/foto/".$ultimo_id.".jpg")); $height = 100; $width = (int)(($imagehw[0]*100)/$imagehw[1]); $thumb = imagecreatetruecolor($width,$height); $source = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'].'public/foto/'.$ultimo_id.'.jpg'); imagecopyresized($thumb, $source,0,0,0,0, $width, $height,$imagehw[0], $imagehw[1]); imagejpeg($thumb, $_SERVER['DOCUMENT_ROOT'].'public/foto/thumbnail/'.$ultimo_id.'_thumb.jpg',100); anyone has a clue? thanks in advance. paolo
  5. Hello My aim is to resize pics for ex. 120x90 ,(or 100x70)no matters Anyway, i am not a php programmer , but i understand thebasis i found this free script on the net that partially satisfy my aim. list($width, $height, $type, $attr) = getimagesize($_SERVER['DOCUMENT_ROOT'].'public/foto/'.$ultimo_id.'.jpg'); // Create version "120*90" of picture(thumbnail) $thumb = imagecreatetruecolor(120, 90); $source = imagecreatefromjpeg($_SERVER['DOCUMENT_ROOT'].'public/foto/'.$ultimo_id.'.jpg'); imagecopyresized($thumb, $source, 0, 0, 0, 0, 120, 90, $width, $height); the result is that the quality of thumb is not amazing, and i can only resize horizontal image. Has anyone of you experts any clue to how resize in better quality (probabily using % instead of fixed dataof width) starting from only a data fixed (height)? in which way i might resize also the vertical images? Thx in advance to all
  6. Hello Another question: accordin to my point of view, i think should be better including js in php page instead of using ajax xhttp rquest anyone has a clue about how to make dyinamic this gallery using javsacript in a php page? the code is posted above thanks in advancce
  7. Hello. I need som advice to complete the creation of a photogallery realized in javascript but with php that increase everytime by one the number of images uploaded on the server. e.g. thisis the js <script type="text/javascript" language="JavaScript"> var photos=new Array() var which=0 /*Change the below variables to reference your own images. You may have as many images in the slider as you wish*/ photos[0]="photo/1.jpg" photos[1]="photo/2.jpg" photos[2]="photo/3.jpg" photos[3]="photo/4.jpg" photos[4]="photo/5.jpg" function backward(){ if (which>0){ window.status='' which-- document.images.photoslider.src=photos[which] } } function forward(){ if (which<photos.length-1){ which++ document.images.photoslider.src=photos[which] } else window.status='End of gallery' } </script> The list of pics is dynamic. Php moves the pics in the directory photo". $path="public/photos/"; $newname=$path.$las_id.".jpg"; move_uploaded_file($file_temp,$newname); header("Location:pics.php"); How to use php in this case? or is more a js issue? ??? I need just to add the new pic uploaded using php to the gallery in JS. (Is it called ajax?) thanks for advices
  8. Thx I have a glance and then let you know Cheers
  9. Hi Sorry man, but i don't get how to link to my file I mean, the upload file or view file? $src_img =imagecreatefromgif("http://www.example.com/download.php"); Download.php should is like Upload? or view? sorry
  10. Hello Angel. thx ! It's cool Just a question this is my viewer.php file which print on video the pic. echo "thanks for upload pic:"; echo "<br />"; echo "number:"; $nesql = "SELECT id_pic, description FROM (SELECT id_pic, description FROM foto ORDER BY id_pic DESC) a LIMIT 1"; $nentry = mysql_query ($nesql); $new = mysql_fetch_row ($nentry); echo "<span style='font-size: 16px; font-weight:bold'> "; print_r ($new[0]); echo "<br />"; echo "</span>"; echo "<span style='font-size: 16px;font-weight:bold'>name: "; print_r ($new[1]); echo "<br />\n"; echo "<img src = 'http://www.xxxxx.com/public/foto/".$new[0].".jpg' />"; echo "</span>"; echo "<br />\n"; I am a noob, very sorry, don't know how and where linkin your script with mine. I think they must be different script, mustn't they? But theproblem for me it's to u.s. which varioable to be used here, wher put the link to resize.php hope i am clear Bye p.
  11. HelloEverybody Anyone should be able to help me out to find some goodscripts on the web to resize allthe pictures I upload dinamically from client to server? I simply wantto create thumbs for this purpose thanks Paolo:))
  12. Hello, noob here Just ask you this I am bulding a website for a photographer. Need to upload pics from the net, choosen by client, then move this pics into the the website to be viewed I created something like this and it works. I checked and the pics are found on my linux server. So i have a table on the db mysql where the pics details are correctly saved Now I need to insert last pic uploaded on my web page, "pictureview.php."with name and descriptio but I don't really have a clue about how to make the first step!!! please, someone may give me some advices? Thx in advance:))))) Paolo $host = "xxcxcx"; $user = "xcxcxcx"; $password = "xcxcxcxx"; $dbname = "xcxcxcxcx"; $cxn = mysql_connect($host,$user,$password); mysql_select_db($dbname); if (!$cxn) { echo 'Error server MySQL'; exit(); } else { $insertSQL = "INSERT INTO foto (description) VALUES ('".$_POST['description']."')"; to mysql_select_db($dbname); $Result1 = mysql_query($insertSQL) or die(mysql_error()); $ultimo_id = mysql_insert_id(); $file_temp=($_FILES['userfile']['tmp_name']); $percorso="public/foto/"; $nuovo_nome=$percorso.$ultimo_id.".jpg"; $inviato = file_exists($file_temp); } if ($inviato) { move_uploaded_file($file_temp,$nuovo_nome); header("Location:Pictureview.php"); } else { header("Location:Errore.php"); } ?>
  13. Nothing changed. Thx as well, i will try later. No prob, you have been great to help me i appreciate I am really noob so it's more complicated!! ciao
  14. [ code] <?php $giorno = $_POST['giorno']; $mese = $_POST['mese']; $anno = $_POST['anno']; $orario = $_POST['orario']; $direzione = $_POST['direzione']; $annunciata = $_POST ['annunciata']; $var = $annunciata; if (md5($usercode)==$_SESSION['vercode']) { //code right } else { //code wrong echo "code wrong!!!"; exit(); } ?> [ /code] It seems correct but not still not works
  15. tx for your patience i am going to try your tip p.s. do i have to insert this at the top of that page? session_start(); cheers
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.