Jump to content


[Resolved] Need help with image gallery snippet


5 replies to this topic

#1 asphalt43

    Etomite Forum Newbie

  • Member
  • 3 posts

Posted 21 August 2007 - 12:08 PM

Hello,

I have trouble with my snippet running livehost.
It is a simple image gallery. I have thumbs that pass variables to the snippet through the address bar.
// html link example: ?id=55&pid=in10
I had it running livehost but then it stopped refreshing the images after the page was loaded. It changes the images only  when I navigate to another menu id.
It works ok localhost though.

eto 0.6.1.4 Final
PHP Version 4.4.4
mysql 4.1.22
Apache/1.3.37

$id = $_GET['id']; // menu id
   $pid = $_GET['pid']; //picture id
   $output= "";

   //debug
   echo $pid;
   echo "<br/>";
   echo $id;

   // given the menu id we assign description and image path variables as arguments
   switch ($id) {
	default:
	case 55: {return show_img("i/b", "title 1", $pid); }break; 
     case 56: {return show_img("m/b", "title 2", $pid); }break; 
     case 57: {return show_img("g/b", "title 3", $pid); }break; 
     case 58: {return show_img("o/b", "title 4", $pid); }break; 
     case 59: {return show_img("t/b", "title 5", $pid); }break; 
     case 60: {return show_img("d/b", "title 6", $pid); }break; 
     case 61:
	case 62:
	case 63: return; break;
   }

   //function: insert image given the $pid variable
   function show_img($imgpath, $desc, $pid)
	{
	$pid = $_GET['pid']; 
	$server_root = 'http://'.$_SERVER['SERVER_NAME'];
	$ins_img = "$server_root/i/$imgpath/$pid.jpg"; 
	//image size
	$imgsize = @GetImageSize($ins_img);
	$output .= "<div id=\"big\">";
	$output .= "<img src=\"".$ins_img."\" ".$imgsize[3]." alt=\"".$desc."\" />";
	$output .= "</div>"; 
	return $output."";
	};


Any suggestions?

Thank you in advance.

Edited by asphalt43, 21 August 2007 - 01:15 PM.


#2 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 21 August 2007 - 01:16 PM

Where did the formatting of your code go to...??? It would be a lot easier to debug if there was some structure there...

I'm trying to sort through the code but I think I may have found something... The default: for a switch...case logic block needs to be the last item, not the first... Think of it as the last resort before failing out the bottom...

#3 asphalt43

    Etomite Forum Newbie

  • Member
  • 3 posts

Posted 21 August 2007 - 01:19 PM

View PostRalph, on Aug 21 2007, 05:16 PM, said:

Where did the formatting of your code go to...??? It would be a lot easier to debug if there was some structure there...

The formatting should be fine now.

#4 asphalt43

    Etomite Forum Newbie

  • Member
  • 3 posts

Posted 21 August 2007 - 01:29 PM

Thank you. This issue is resolved now.

The problemo occured because the pages were cached(etomite settings)

Edited by asphalt43, 21 August 2007 - 01:29 PM.


#5 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 21 August 2007 - 01:39 PM

View Postasphalt43, on Aug 21 2007, 09:29 AM, said:

Thank you. This issue is resolved now.

The problemo occured because the pages were cached(etomite settings)
Caching would definitely cause the problem... Glad you got it sorted...

#6 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 21 August 2007 - 01:55 PM

Glad you got it sorted!

closed as no longer needed





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users