Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/03/2012, 11:14
Avatar de mazaku
mazaku
 
Fecha de Ingreso: septiembre-2009
Ubicación: Veracruz
Mensajes: 104
Antigüedad: 14 años, 7 meses
Puntos: 0
Pregunta Implementar cambiar imagenes en un select

Buen dia, tengo el siguiente problema. consegui este visor de imagenes pero quisiera adaptarle que con un select cambie de imagenes tambien, le agregue un codigo que cambia las imagenes por el select pero no se como adaptarlo a que sea dentro de la misma galeria ya que me cambia las imagenes pero de forma independiente no dentro del visor.

este es el codigo, hasta abajo esta el codigo para cambiar el select.

espero haberme explicado bien, saludos agradezco su ayuda y apoyo

Código:
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>

<?php
// ------------------------------------------------------------------------- //
// Comic Gallery 1.2                                                        //
// ------------------------------------------------------------------------- //
// Copyright (C) 2005 Stuart Robertson                                      //
// http://www.designmeme.com/                                                //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or        //
// (at your option) any later version.                                      //
//  A summary is available at http://creativecommons.org/licenses/GPL/2.0/  //
// ------------------------------------------------------------------------- //
// Edit the code below to configure your Comic Gallery                      //
// ------------------------------------------------------------------------- //
$c_capitulo ="".$reg['c_capitulo']."";
// Your images directory, relative to the page calling this script
$imagedir="".$reg['c_path']."";

// To start at the last image use "last"
$startimage="first";

// Copyright name to display, for none use " "
$copyright=" ";

// Creative Commons license, for none use " "
// example: "http://creativecommons.org/licenses/by/2.0/"
$creativecommons=" ";

// type of divider, for none use " "
$divider="&middot;";

// show arrows, for none use 0
$arrows=1;

// show back and next, for none use 0
$backnext=1;

// show back and next, for none use 0
$firstlast=0;

// show numbers, for none use 0
$numbers=0;

// numbers per line
$linelength=10;

// navigation position, for aboe use "above"
$navplacement="above";

// ------------------------------------------------------------------------- //
// Do not edit below this line
// ------------------------------------------------------------------------- //

//    initialize variables
$pics=array();
$count=0;

// Open the directory
$comicdir=opendir($imagedir);

//    read directory into pics array
while (($file = readdir($comicdir))!==false) {
    //    filter for jpg, gif or png files...
    if (substr($file,-4) == ".jpg" || substr($file,-4) == ".gif" || substr($file,-4) == ".png" || substr($file,-4) == ".JPG" || substr($file,-4) == ".GIF" || substr($file,-4) == ".PNG"){
        $pics[$count] = $file;
        $count++;
        }
}
closedir($comicdir);

// check for the picture to view
$pic=$_GET['p'];
//    if no picture variable...
if ($pic=="") {
    if ($startimage!="last"){ $pic=1; }
    else { $pic=$count; }
}

//    sort the filenames alphabetically
sort($pics);
reset($pics);

//    determine which picture to get
for ($f=0;$f<=sizeof($pics)-1;$f++){if ($pic==$pics[$f]){$selected = $f+1;}}

//  check for javascript...
if ($pic && !preg_match("/javascript/",$pic)){

    //  get current image file
    $current=$pics[$pic-1];
    $next=$pic+1;
    if ($next > sizeof($pics)){ $next=sizeof($pics); }
    $back=$pic-1;
    if ($back < 1){ $back=1; }
	
	// funcion agregar select
	
	$c2 = 1;
 function listPics($pics)
{
	while(list($num, $pic) = each($pics))
	{
	global $c_capitulo;
			echo "<option value='".$_SERVER['PHP_SELF']."?capitulo=$c_capitulo&c=$p+1'>$c2</option>\n";
			$c2++;    
	}
}
function getPicName($p, $pics)
{
	return preg_replace("/\.jpg$|\.gif$|\.png$/i", "", $pics[$p]);
}

    //  display image above nav
    if ($navplacement!="above"){
        if (substr($current,-4) == ".jpg" || substr($current,-4) == ".gif" || substr($current,-4) == ".png" || substr($current,-4) == ".JPG" || substr($current,-4) == ".GIF" || substr($current,-4) == ".PNG"){
                if ($pic < sizeof($pics)){
                    echo"\n<p id=\"cg_img\"><a href=\"?capitulo=$c_capitulo&p=".$next."\"><img src=\"".$imagedir."/".$current."\" alt=\"Next\" /></a></p>\n";
                } else {
                echo"\n<p id=\"cg_img\"><img src=\"".$imagedir."/".$current."\" alt=\"End\" /></p>\n";
                }
            }
    }

    // display back and next
    if ($backnext != 0 || $arrows != 0){
            if (sizeof($pics) > 1){
                echo "<p id=\"cg_nav1\">";
                if ($firstlast != 0){
                    if ($pic > 1){    echo "<a href=\"?capitulo=$c_capitulo&p=1\" id=\"cg_first\"><span>First</span></a>"; }
                    else { echo "<span id=\"cg_first\"><span>First</span></span>"; }
                    echo "<span class=\"cg_divider\"> ".$divider." </span>";
                }
                if ($pic > 1){
                    echo "<a href=\"?capitulo=$c_capitulo&p=".$back."\" id=\"cg_back\"><span>";
                    if ($arrows != 0) { echo "&laquo; "; }
                    if ($backnext != 0) { echo "Anterior"; }
                    echo "</span></a>";
                } else {
                    echo "<span id=\"cg_back\"><span>";
                    if ($arrows != 0) { echo "&laquo; "; }
                    if ($backnext != 0) { echo "Anterior"; }
                    echo "</span></span>";
                }
                echo "<span class=\"cg_divider\"> ".$divider." </span>";
                if ($pic < sizeof($pics)){
                    echo "<a href=\"?capitulo=$c_capitulo&p=".$next."\" id=\"cg_next\"><span>";
                    if ($backnext != 0) { echo "Siguiente"; }
                    if ($arrows != 0) { echo " &raquo;"; }
                    echo "</span></a>";
                } else {
                    echo "<span id=\"cg_next\"><span>";
                    if ($backnext != 0) { echo "Siguiente"; }
                    if ($arrows != 0) { echo " &raquo;"; }
                    echo "</span></span>";
                }
                if ($firstlast != 0){
                    echo "<span class=\"cg_divider\"> ".$divider." </span>";
                    if ($pic < sizeof($pics)){    echo "<a href=\"?p=". sizeof($pics) ."\" id=\"cg_last\"><span>Last</span></a>"; }
                    else { echo "<span id=\"cg_last\"><span>Last</span></span>"; }
                }
                echo "</p>\n";
            }
    }

    // display numbers
    if ($numbers != 0){
        if (sizeof($pics) > 1){
            //    display textlinks
            echo "<p id=\"cg_nav2\">";
            // loop over images
            for ($f=1;$f<=sizeof($pics);$f++){
                // if the link to the pic is the selected one, display a bold number and no link
                if ($pic==$f){echo "<b>".$f."</b>";}
                // otherwise display the link
                else{echo "<a href=\"?p=".$f."\">".$f."</a>";}
                // add dividers and linebreaks
                if (($f % $linelength) == 0) {
                    echo "<br />";
                }
                else {
                    if ($f!=sizeof($pics)){
                        echo "<span class=\"cg_divider\"> ".$divider." </span>";
                    }
                }
            }
            echo "</p>\n";
        }
    }

    //  display image below nav
    if ($navplacement=="above"){
        if (substr($current,-4) == ".jpg" || substr($current,-4) == ".gif" || substr($current,-4) == ".png" || substr($current,-4) == ".JPG" || substr($current,-4) == ".GIF" || substr($current,-4) == ".PNG"){
                if ($pic < sizeof($pics)){
                    echo"\n<p id=\"cg_img\"><a href=\"?capitulo=$c_capitulo&p=".$next."\"><image src=\"".$imagedir."/".$current."\" alt=\"Next\" border=\"0\"></a></p>\n";
                } else {
                echo"\n<p id=\"cg_img\"><image src=\"".$imagedir."/".$current."\" alt=\"End\" /></p>\n";
                }
            }
    }
	
    }
?>
<form name="menu">
		  <select name="jumpMenu" onChange="MM_jumpMenu('parent',this,0)">
		  <?php 
$files = scandir("".$reg['c_path'].""); 
$dir ="".$reg['c_path']."";

$c1 = count($files);
$c2 = 1;
for($i=0; $i<$c1; $i++)
{
  if(strlen($files[$i]) > 3)
  {
  $extension = strtolower(substr($files[$i], -4));
    if(($extension == ".gif") OR ($extension == ".jpg") OR ($extension == ".png"))
    {
    echo "<option value='$dir".$files[$i]."'>$c2";
      	$c2++;    
    }
  }
  }
 ?>
          </select>
		</form>
<?php 
}
?>