Jump to content
Fórum Script Brasil
  • 0

Galeria De Imagens - Enviar Imagem A Amigo!


Guest Guest

Question

Olá pessoal....

Tenho o seguinte script que exibe as imagens de um diretório criando thumbs e paginando e etc....

Ao clicar na imagem ela é ampliada e nesta nova exibição, existem os botões HOME e PRINT ...gostaria de saber como faria para criar um 3º botão chamado ENVIAR FOTO para o usuário poder enviar a foto, q está sendo visualizada, para um amigo!

segue o código:

 

<?

    $time_start = microtime(true);

   

   

    $noimage = 0;

   

    if ($dh = opendir($_images_dir_)) {

    while (($f = readdir($dh)) !== false) {

if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'jpg'))

{

    $imageinfo = getimagesize($_images_dir_.$f);

    $width = $imageinfo[0];

    $height = $imageinfo[1];

    $size = round(filesize($_images_dir_.$f)/1024,1).' KB';

    $noimage++;

        $images[] = array('filename' => $f, 'width' => $width, 'height' => $height, 'size' => $size);

    array_multisort($images, $_sort_, SORT_REGULAR);

}

    }

    closedir($dh);

    }

    if($noimage)

    {

if($_GET["img"] != '')

{

    echo '<p class=title">'.$images[$_GET["img]][filename].'</p>';

    if($images[$_GET["img"]][filename] != '')

    {

   

  if($_GET["img"])

      $_no_ = ceil(($_GET["img"]+1)/$_no_pics_per_page_);

  else

      $_no_ = 1;

 

  if($_GET["img"] == 0)

      $side = '<p class=link"><a href="'.$_SERVER["PHP_SELF].'?no='.$_no_.'" class="link"><img border="0" src="http://www.urbanusbar.com.br/images/bla.gif"/><a href="javascript:window.print()"class="link"><img border="0" src="http://www.urbanusbar.com.br/images/print.gif"/><a href="'.$_SERVER["PHP_SELF"].'?img=.($_GET["img]+1).'" class="link"> >></a></p>';

  elseif($_GET["img"] == ($noimage-1))

      $side = '<p class=link"><a href="'.$_SERVER["PHP_SELF].'?img='.($_GET["img"]-1).'" class=link"><< </a>&nbsp;<a href="'.$_SERVER["PHP_SELF].'?no='.$_no_.'" class="link"><img border="0" src="http://www.urbanusbar.com.br/images/bla.gif"/><a href="javascript:window.print()"class="link"><img border="0" src="http://www.urbanusbar.com.br/images/print.gif"/></a></p>';

  else

      $side = '<p class="link"><a href="'.$_SERVER["PHP_SELF"].'?img=.($_GET["img]-1).'" class="link"><< </a>&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?no=.$_no_.'" class="link"><img border="0" src="http://www.urbanusbar.com.br/images/bla.gif"/><a href="javascript:window.print()"class="link"><img border="0" src="http://www.urbanusbar.com.br/images/print.gif"/></a>&nbsp;<a href="'.$_SERVER["PHP_SELF].'?img='.($_GET["img"]+1).'" class=link"> >></a></p>';

  echo $side.'<p align="center"><img  class= "link" src="picture.php?img='.$images[$_GET["img]][filename].'&show=full" border='.$_border_.'" hspace="'.$_hspace_.'" vspace="'.$_vspace_.'" alt="'.$images[$_GET["img]][filename].'" title='.$images[$_GET["img]][filename].', '.$images[$_GET["img"]][width].'x'.$images[$_GET["img"]][height].', '.$images[$_GET["img"]].'" ></p>'.$side;

    }

}

else

{

    echo '<p class=title">'.$_page_title_.'</p>';

// echo $noimage.'<br>'.print_r($images);

if($noimage > $_no_pics_per_page_)

    $norows = ceil($_no_pics_per_page_/$_no_cols_);

else

    $norows = ceil($noimage/$_no_cols_);

$nopos = ceil($noimage/$_no_pics_per_page_);

// echo $nopos;

echo '<table border="0" align="center" cellpadding="0" cellspacing="0">

';

if($_GET["no] == "")

    $no = 1;

else

    $no = $_GET["no"];

   

$index=abs($no-1)*$_no_pics_per_page_;

if(($noimage-$index)<$_no_pics_per_page_)

    $norows= ceil(($noimage-$index)/$_no_cols_);

for($a = 1;$a<=$norows;$a++)

{

    echo '

    <tr>

    ';

  for($b = 1;$b<=$_no_cols_;$b++)

  {

      if($images[$index][filename] != '')

      {

  echo '<td width='.(2*$_vspace_+$_width_min_).'" valign="top" align="center"><a href="'.$_SERVER["PHP_SELF].'?img='.$index.'" ><img  class="link"src="picture.php?img='.$images[$index][filename].'" border='.$_border_.'" hspace="'.$_hspace_.'" vspace="'.$_vspace_.'" alt="'.$images[$index][filename].'" title="'.$images[$index][filename].', '.$images[$index][width].'x'.$images[$index][height].', '.$images[$index].'"></a>

  ';

  if($_filename_)

      echo '<span class="name">'.$images[$index][filename].'</span><br>';

  echo '</td>';

  $index++;

      }

      else

  echo '<td width="'.(2*$_vspace_+$_width_min_).'">&nbsp;</td>';

  }

    echo '</tr>

    ';

}

echo '

</table>

';

if($nopos>1)

{

    echo '<p class="stopka">';

        for($i=1;$i<=$nopos;$i++)

    {

        if($i == $no)

            echo '<font class="stopka_select">'.$i.'</font>&nbsp;';

        else

            echo '<a href="'.$_SERVER["PHP_SELF].'?no='.$i.'" class="stopka">'.$i.'</a>&nbsp;';

    }

    echo '</p>';

}

}

    }

    else

die('No images in directory');

    $time_end = microtime(true);

    $time = $time_end - $time_start;

    echo '<p class="exe"><br>:: Fotos da festa : '.count($images).'</p>';

?> 

Para visualizar a galeria: GALERIA

Agradeço a atenção de todos

Rodrigo

rodrigoabb@gmail.com

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      651.8k
×
×
  • Create New...