Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    collegamenti a immagini nella stessa pagina

    ciao a tutti, sono nuovo qui...avrei una domanda da farvi.
    Uso uno script per creare da determinate cartelle le thumb delle foto presenti in esse, impaginarle e creare i collegamenti..però vorrei modificarlo in modo tale che le foto si aprano nella stessa pagina e non in una pagina bianca..sapreste aiutarmi?

    vi posto il codice

    Codice PHP:
    <?php

         
    function thumbnalize($file$sx=NULL$sy=NULL$filename=NULL) {

              
    $info=@getimagesize($file);



              switch(
    $info[2]) {

               case 
    1//gif

                   
    $src=imagecreatefromgif($file);      

                   break;

               case 
    3//png

                    
    $src=imagecreatefrompng($file); 

                   break;

               case 
    2//jpg

               
    default: 

                    
    $src=imagecreatefromjpeg($file); 

                   break;

              }

              if(
    $src) {

                   
    $x=imagesx($src); 

                   
    $y=imagesy($src); 

                   if(
    $x&&$y) {

                        if(!
    $sx && !$sy$sy=150;

                        if(!
    $sx$sx=$x*($sy/$y);                               

                        if(!
    $sy$sy=$y*($sx/$x); 

                        
    //if($sx>$x && $sy>$y) { $sx=$x; $sy=$y; }

                        
    $dst=@imagecreatetruecolor($sx,$sy);                          

                        if(
    $dst) { 

                             if(!
    $filename) {

                                  if(!
    is_dir("thumbs")) mkdir("thumbs");

                                  
    $filename="thumbs/$file";

                             }

                             
    imagecopyresampled($dst$src0,00,0$sx,$sy$x,$y); 

                             @
    imagejpeg($dst$filename50);

                             if(
    file_exists($filename)) {

                                  
    chmod($filename0666);

                                  return 
    true;

                             }

                        }

                   }

              }

              return 
    false;

         }



         class 
    thumbs {

              var 
    $name,$orig,$thumb,$desc;

              var 
    $x,$y,$dir,$tdir;

              var 
    $nothumb,$make,$data,$force;

              

              function 
    thumbs($dir=".") {

                   
    $this->x=NULL;

                   
    $this->y=NULL;

                   
    $this->dir=trim($dir,".\\/");

                   
    $this->tdir=($this->dir?$this->dir.'/':"")."thumbs";

                   
    $this->nothumb=NULL// file for pictures without thumb

                   
    $this->make=function_exists("thumbnalize");

                   
    $this->data=glob("$dir/*.jpg");

                   
    $this->force=false;               

                   if(!
    is_dir($this->tdir)) mkdir($this->tdir);

              }

                        

              function 
    get() {

                   if(!
    is_array($this->data)) return false;

                   
    $f=array_shift($this->data);

                   if(!
    $f) return false;

                   
    $p=pathinfo($f);

                   
    $dir=$this->dir?$this->dir."/":"";

                   
    $this->name=basename($f,'.'.$p['extension']);



                   
    $this->orig=$dir.$p['basename'];

                   

                   
    $this->thumb=$this->tdir.'/'.$p['basename'];



                   
    $this->desc=implode("",(array)@file("$f.desc"));



                   if(
    $this->make && ($this->force || !file_exists($this->thumb))) {

                        echo 
    "Creo {$this->thumb}: ";

                        if(
    thumbnalize($this->orig,$this->x,$this->y,$this->thumb)) {

                             echo 
    "ok";

                        } else {

                             echo 
    "failed";

                             
    $this->thumb=$this->nothumb;          

                        }

                        echo 
    "
    "
    ;

                   }

                   return 
    true;

              }     

         }



         
    $title=@file_get_contents("title.txt");

         
    $dir=@$_GET['d'];

    ?>

    <html>

    <head>

         <title><?=$title?></title>

         <link rel="stylesheet" href="styles.css" type="text/css">

    </head>

    <body>

    <h1><?=$title?></h1>

    <form name="thumbs" method="get" class="selector">

         <select name="d" onChange="submit();">

    <? 

         
    foreach(glob('*') as $d) {

              if(
    is_dir($d)) {

                   if(!
    $dir$dir=$d;

                   
    $name=basename($d);

                   
    $desc=@file_get_contents("$d.desc");

                   if(!
    $desc$desc=$name;

                   
    $sel=$name==$dir?" selected":"";

                   echo 
    "<option value=\"$name\"$sel>$desc</option>";

              }

         }

    ?>

         </select> <input name="go" type="submit" value="»">

    </form>

    <?     

         
    if($dir) {

              
    $t=new thumbs($dir);

    ?>

    <div class=thumbs>

         <?     while($t->get()) { ?>

              [url="<?=$t->orig;?>"]name;?>">[img]<?=$t->thumb;?>[/img][/url]

         <? ?>

    </div>

    <?     

         
    } else { 

              foreach(
    glob('*') as $v) {

                   if(
    is_dir($v)) {

                        
    $d=basename($v);

                        echo 
    "<a href=\"?d=$d\">";

                        echo 
    $v;

                        if(
    file_exists($v.".desc")) {

                             echo 
    " - ";

                             
    readfile($v.".desc");

                        }

                        echo 
    "</a>
    "
    ;

                   }

              }

         } 

    ?>

    </body>

    </html>
    I'd kill myself for you. I'd kill you for myself

  2. #2
    nella riga:

    devi togliere:

    codice:
    target="_blank"

  3. #3
    Originariamente inviato da enzo845555
    nella riga:

    devi togliere:

    codice:
    target="_blank"

    ciao enzo..mi sono spiegato male..guarda qua

    nella sezione foto...

    io vorrei che si aprissero le foto in una pagina come quella del mio sito..è fattibile?
    I'd kill myself for you. I'd kill you for myself

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.