Salta al contenuto

Coding

17.9k Discussioni 86.7k Post

PHP, HTML, CSS, MySQL, Javascript, Python e tutto il resto

  • Pagine diverse in base agli enum

    2
    steave67
    0 Votazioni
    2 Post
    502 Visualizzazioni
    Scusate il link della guida è questo: mrwebmaster.it/php/articoli/creare-forum-php-1a-parte_270.html
  • Inclidere una pagina php in java

    Spostato
    1
    josk
    0 Votazioni
    1 Post
    515 Visualizzazioni
    Nessuno ha risposto
  • Comportamento imprevisto query select... order by

    4
    popeye
    0 Votazioni
    4 Post
    605 Visualizzazioni
    Certo che si !!! grazie 1000 ciao.
  • Pagina con stesso css cambia

    Spostato
    3
    bboymasa
    0 Votazioni
    3 Post
    510 Visualizzazioni
    Ma il tasto edit non c'è o sbaglio? Comunque ho risolto, il problema era la scrollbar che mi faceva spostare la tabella al centro ho risolto con un position: absolute;
  • Problema con il login

    3
    manu55
    0 Votazioni
    3 Post
    585 Visualizzazioni
    Grazie tantissimo...sono riuscito a risolvere il problema...e grazie anche per il benvenuto nel forum.
  • Tag select e database

    33
    francodace
    0 Votazioni
    33 Post
    3k Visualizzazioni
    Magnifico. Ci si legge in giro.
  • creare menù a tendina in html

    Spostato
    11
    sgugniz
    0 Votazioni
    11 Post
    38k Visualizzazioni
    Salve,ho lo stesso problema io!...Sono alle primissime armi e ovviamente non so come "passare"il menù dallo stato grafico a codice htlm!...Potreste darmi una mano?..Grazie!
  • Tag select e database

    Spostato
    2
    francodace
    0 Votazioni
    2 Post
    563 Visualizzazioni
    Ho risolto, grazie comunque.
  • Php include e netsons

    3
    bboymasa
    0 Votazioni
    3 Post
    628 Visualizzazioni
    Ehm no, non me ne intendo poi tanto di php, ora provo e ti faccio sapere. Edit: ho scritto: <?php echo "$oc"; // IF ?> ma non so se è correto perchè non mi visualizza niente...ma se è simile al C penso che debba mettere qualche elemento prima di assegnargli la variabile o sbaglio? scusa tanto la mia ignoranza in materia.
  • Php Thumbnail e watermark

    7
    colvi
    0 Votazioni
    7 Post
    2k Visualizzazioni
    To utilizzando uno script trovato in rete e devo dire che funziona questa è la classe: <?php /** Smart, easy and simple Image Manipulation @author Alessandro Coscia, Milano, Italy, codicefacile. it/ smartimage @copyright LGPL @version 0.9.6 / class SmartImage { /* * Source file (path) */ private $src; /** * GD image's identifier */ private $gdID; /** * Image info */ private $info; /** * Initialize image * * @param string $src @param boolean $big @return SmartImage */ public function SmartImage($src, $bigImageSize=false) { // In case of very big images (more than 1Mb) if ($bigImageSize) $this->setMemoryForBigImage($src); // set data $this->src = $src; $this->info = getimagesize($src); // open file if ( $this->info[2] == 2 ) $this->gdID = imagecreatefromjpeg($this->src); elseif ( $this->info[2] == 1 ) $this->gdID = imagecreatefromgif($this->src); elseif ( $this->info[2] == 3 ) $this->gdID = imagecreatefrompng($this->src); } /** Set memory in case of very big images (more than 1Mb) new SmartImage($src, true) to activate this function Works with (PHP 4 >= 4.3.2, PHP 5) if compiled with --enable-memory-limit or PHP>=5.2.1 Thanks to Andrvm and to Bascunan for this feature */ private function setMemoryForBigImage($filename) { $imageInfo = getimagesize($filename); $memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $imageInfo['channels'] / 8 + Pow(2, 16)) * 1.65); $memoryLimit = (int) ini_get('memory_limit')*1048576; if ((memory_get_usage() + $memoryNeeded) > $memoryLimit) { ini_set('memory_limit', ceil((memory_get_usage() + $memoryNeeded + $memoryLimit)/1048576).'M'); return (true); } else return(false); } /** * Resize an image * * @param integer $w * @param integer $h * @param boolean $cutImage * @return boolean Everything is ok? */ public function resize($width, $height, $cutImage = false) { if ($cutImage) return $this->resizeWithCut($width, $height); else return $this->resizeNormal($width, $height); } /** * Resize an image without cutting it, only do resize * saving proportions and adapt it to the smaller dimension * * @param integer $w * @param integer $h */ private function resizeNormal($w, $h) { // set data $size = $this->info; $im = $this->gdID; $newwidth = $size[0]; $newheight = $size[1]; if( $newwidth > $w ){ $newheight = ($w / $newwidth) * $newheight; $newwidth = $w; } if( $newheight > $h ){ $newwidth = ($h / $newheight) * $newwidth; $newheight = $h; } $new = imagecreatetruecolor($newwidth, $newheight); $result = imagecopyresampled($new, $im, 0, 0, 0, 0, $newwidth, $newheight, $size[0], $size[1]); @imagedestroy($im); $this->gdID = $new; $this->updateInfo(); return $result; } /** * Resize an image cutting it, do resize * adapt it resizing and cutting the original image * * @param integer $w * @param integer $h */ private function resizeWithCut($w, $h){ // set data $size = $this->info; $im = $this->gdID; if( $size[0]>$w or $size[1]>$h ){ $centerX = $size[0]/2; $centerY = $size[1]/2; $propX = $w / $size[0]; $propY = $h / $size[1]; if( $propX < $propY ){ $src_x = $centerX - ($w*(1/$propY)/2); $src_y = 0; $src_w = ceil($w * 1/$propY); $src_h = $size[1]; } else { $src_x = 0; $src_y = $centerY - ($h*(1/$propX)/2); $src_w = $size[0]; $src_h = ceil($h * 1/$propX); } // Resize $new = imagecreatetruecolor($w, $h); $result = imagecopyresampled($new, $im, 0, 0, $src_x, $src_y, $w, $h, $src_w, $src_h); @imagedestroy($im); } else{ $new = $im; } $this->gdID = $new; $this->updateInfo(); return $result; } /** * Add a Water Mark to the image * (filigrana) * * @param string $from * @param string $waterMark */ public function addWaterMarkImage($waterMark, $opacity = 35, $x = 5, $y = 5){ // set data $size = $this->info; $im = $this->gdID; // set WaterMark's data $waterMarkSM = new SmartImage($waterMark); $imWM = $waterMarkSM->getGDid(); // Add it! // In png watermark images we ignore the opacity (you have to set it in the watermark image) if ($waterMarkSM->info[2] == 3) imageCopy($im, $imWM, $x, $y, 0, 0, imagesx($imWM), imagesy($imWM)); else imageCopyMerge($im, $imWM, $x, $y, 0, 0, imagesx($imWM), imagesy($imWM), $opacity); $waterMarkSM->close(); $this->gdID = $im; } /** * Rotate of $degrees * * @param integer $degrees */ public function rotate($degrees=180) { $this->gdID = imagerotate($this->gdID, $degrees, 0); $this->updateInfo(); } /** * Show Image * * @param integer 0-100 $jpegQuality */ public function printImage($jpegQuality = 100) { $this->outPutImage('', $jpegQuality); } /** * Save the image on filesystem * * @param string $destination * @param integer 0-100 $jpegQuality */ public function saveImage($destination, $jpegQuality = 100) { $this->outPutImage($destination, $jpegQuality); } /** * Output an image * accessible throught printImage() and saveImage() * * @param unknown_type $dest * @param unknown_type $jpegQuality */ private function outPutImage($dest = '', $jpegQuality = 100) { $size = $this->info; $im = $this->gdID; // select mime if (!empty($dest)) list($size['mime'], $size[2]) = $this->findMime($dest); // if output set headers if (empty($dest)) header('Content-Type: ' . $size['mime']); // output image if( $size[2] == 2 ) imagejpeg($im, $dest, $jpegQuality); elseif ( $size[2] == 1 ) imagegif($im, $dest); elseif ( $size[2] == 3 ) imagepng($im, $dest); } /** * Mime type for a file * * @param string $file * @return string */ private function findMime($file) { $file .= "."; $bit = explode(".", $file); $ext = $bit[count($bit)-2]; if ($ext == 'jpg') return array('image/jpeg', 2); elseif ($ext == 'jpeg') return array('image/jpeg', 2); elseif ($ext == 'gif') return array('image/gif', 1); elseif ($ext == 'png') return array('image/png', 3); else return array('image/jpeg', 2); } /** * Get the GD identifier * * @return GD Identifier */ public function getGDid() { return $this->gdID; } /** * Get actual Image Size * * @return array('x' = integer, 'y' = integer) */ public function getSize() { $size = $this->info; return array('x' => $size[0], 'y' => $size[1]); } /** * Set GD identifier * * @param GD Identifier $value */ public function setGDid($value) { $this->gdID = $value; } /** * Free memory */ public function close() { @imagedestroy($this->gdID); } /** * Update info class's variable */ private function updateInfo() { $info = $this->info; $im = $this->gdID; $info[0] = imagesx($im); $info[1] = imagesy($im); $this->info = $info; } } ?> questo è il codice php per la miniatura priva del watermark: <?php /** Smart, easy and simple Image Manipulation @author Alessandro Coscia, Milano, Italy, *codicefacile .it/ smartimage @copyright LGPL */ include "SmartImage.class.php"; // Settings $src = "http://www.giorgiotave.it/forum/images/car.jpg"; $destination = "small/"; // Start! $img = new SmartImage($src); // Resize and save to file $img->resize(120, 80, true); $img->saveImage($destination."new01.jpg", 76); // output image $img->printImage(); $img->close(); ?> questo è il codice php per l'immagine con dimenzione 400x300 con watermark <?php /** Smart, easy and simple Image Manipulation @author Alessandro Coscia, Milano, Italy, codicefacile .it smartimage @copyright LGPL */ include "SmartImage.class.php"; // Settings $src = "http://www.giorgiotave.it/forum/images/car.jpg"; $waterMark = "http://www.giorgiotave.it/forum/images/smartimage.gif"; $destination = "newimages/"; // Start! $img = new SmartImage($src); // Resize and save to file $img->resize(400, 220, true); $img->saveImage($destination."new01.jpg"); // Put a Water Mark and save to file $img->addWaterMarkImage($waterMark); $img->saveImage($destination."new01.jpg", 76); // output image $img->printImage(); $img->close(); ?> Ora volendo riscrivere un unico codice che mi permetta di avere due immagini una 120x80 e una 400x300 con watermark con cartelle di destinazione differenti come potrei fare? Sicuro di una vostra risposta vi auguro buona giornata.
  • Reindirizzare utente in base al browser

    5
    carlitos1982
    0 Votazioni
    5 Post
    740 Visualizzazioni
    Cavoli...hai proprio ragione,questo particolare mi era sfuggito:(): Ora funziona... Grazie Magicale;)
  • Java Banner Ad Rotator Applet

    Spostato
    1
    alessyo
    0 Votazioni
    1 Post
    949 Visualizzazioni
    Nessuno ha risposto
  • Eventuali istruzioni html dopo una redirect con header

    5
    beetlejuice
    0 Votazioni
    5 Post
    2k Visualizzazioni
    Grazie
  • IE 6 problema css

    Spostato
    6
    guydebord
    0 Votazioni
    6 Post
    1k Visualizzazioni
    guydebord grazie claudio stasera provo. si tratta del double margin vero? Probabilmente si.
  • Query con like in php almeno credo

    7
    angelo85ct
    0 Votazioni
    7 Post
    677 Visualizzazioni
    Le COLLATION definiscono il modo in cui vengono confrontati i set di caratteri (CHARSET) a cui fanno riferimento. Qui è spiegato meglio: database . html.it/guide/lezione/2445/i-set-di-caratteri/ Alessandro
  • Ma echo ha una dimensione?

    2
    amadeusorrento
    0 Votazioni
    2 Post
    330 Visualizzazioni
    Ciao, è un mezzo bug di mssql. Puoi provare a risolverlo cambiando alcune impostazionei di configurazione di php: Modificando php.ini: mssql.textlimit = 65536 mssql.textsize = 65536 Oppure nella pagina php prima di eseguire la query: mssql_query ( 'SET TEXTSIZE 65536' , $myConn ); ini_set ( 'mssql.textlimit' , '65536' ); ini_set ( 'mssql.textsize' , '65536' ); Come suggerito qui: it . php.net/manual/en/function.mssql-query.php#64470 Alessandro
  • Controllo checkbox selezionati

    Spostato
    7
    pettedemon
    0 Votazioni
    7 Post
    4k Visualizzazioni
    Allora ho inserito lo script nella mia pagina, i checkbox sono 50 e quindi ho cambiato il numero iniziale. Pero' non mi fa il controllo . <script language="javascript" type="text/javascript"> function check(){ numero_check = 50; checkate = 0; for(i=0;i<numero_check;i++) { if(document.getElementById('check_'+i).checked) { checkate++; } } if(checkate > 10) { alert('Hai checkato '+checkate+' checkbox!'); return false; } else { document.form1.action="convalida_chart.php"; return true; } } </script> <input type="checkbox" name="mycheck[<?php echo($i); ?>]" id="check_<?php echo($i); ?>" value="<? echo($titolo)." - ".($artista); ?>" /> <form id="form1" name="form1" method="post" > <input type="image" onClick="check()" src="images/registrazione/invia.png" />
  • Script controllo cookies

    8
    thebiggun
    0 Votazioni
    8 Post
    967 Visualizzazioni
    Magicale I dati per mandarti la fattura? Scherzi a parte... Pagina discalimer: <?php session_start(); $_SESSION['disclaimer']="Letto"; ?> Pagina login: <?php session_start(); if (!isset($_SESSION['disclaimer']) { header("Location: qui_la_pag_disclaimer"); exit(); } ?> Appena ho un minuto provo... poi ti faccio sapere. Grazie
  • Impossibile aprire il sito. Operazione terminata

    Spostato
    5
    nemoprincess
    0 Votazioni
    5 Post
    6k Visualizzazioni
    IE fa spesso i capricci con alcuni Javascript, per risolvere il problema spostate il codice Javascript in fondo al <body> o anche oltre, ed aggiungete defer="defer" alla chiamata dello script.
  • Sviluppo applicazioni su facebook

    3
    first100
    0 Votazioni
    3 Post
    643 Visualizzazioni
    [..] Si proprio stasera sono riuscito a fare una banale applicazione FUNZIONANTE, dopo due giorni che ci sbattevo la testa, comunque la documentazione non sempre è chiarissima , grazie per il tuo aiuto comunque, Ciao
Home Accedi Registrati