5, September 2008

Photo Album Problem - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Photo Album Problem
« previous next »
Pages: [1] Print

Author Topic: Photo Album Problem  (Read 622 times)
Supreme Overlord
***
Gender: Female
Posts: 148
1008 credits
Members referred : 0



« on: Jun 02, 2007, 03:37:17 AM »

I have several php photo albums on my site.  They all work fine, and follow the same code, the only difference is the name and directory.  I have a new album I am trying to incorporate.  And it won't work.  All I changed is the directory and some other file names.  The only difference is that the new pictures have some panoramic pictures.

Code:
<?php
$photo 
$_GET['P'];


$dirlist "images/ablum1/";  // leave it alone if it's the same directory  
// Change it if you want to view a different
// directory. default value:  "./"                    

if (is_dir($dirlist)==true // check if directory exists
{
chdir$dirlist );
$handle=opendir"."); // open the directory
$x=0;
$files=array();
while ((
$file readdir($handle))!==false)  // while there's files to read....
{
$pieces explode ("."$file);
if (
$pieces[0] && $pieces[1])  // filename.ext
{
// if (($pieces[1]=="jpg"))  // add only .jpg files
// {
$files[$x]=$file;  // add it to the array.
$x++;
// }
}
}

closedir($handle);    //done finding files

sort($files); // sort them alphabetically
if ($photo == '')
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php
  $picture 
;
  
$row ;
for (
$i=0$i<sizeof($files); $i++) // output each element from the array
{
$picture $picture ;
echo 
"<td width=\"100\"><a href=\"album1.php?P=$i\"><img src=\"resize.php?$files[$i]\" border=\"0\" alt=\"\"></a></td>";
if(
$picture == )
{
?>

  </tr>
        <tr>
         
  <?php
$row 
;
$picture ;
  }
}
?>

        </tr>
      </table></div>
<?php
}
else
{
$i $photo ;
?>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><div align="center"><a href="/photos.php">Back to Photos Page</a></div></td>
        </tr>
        <tr>
          <td><div align="center"><img src="<?php echo"resize2.php?$files[$i]";?>" alt=""></div></td>
        </tr>
        <tr>
          <td><div align="center"><a href="images/gallery/<?php echo"$files[$i]";?>" target="_blank">Show fullscreen</a></div></td>
        </tr>

      </table>
  <table width="50%" border="0" cellspacing="0" cellpadding="0" style="margin-left: 25%; margin-right: 25%; ">
        <tr>
          <td>
  <?php 
  $i 
$i 1
  if(
$i >= 0)
   {
   echo 
"<a href=\"album1.php?P=$i\"><img src=\"resize.php?$files[$i]\" border=\"0\" alt=\"\"></a>"
}
  
?>

  </td>
          <td>
  <?php 
  $i 
$i 2
  if(
$i sizeof($files))
   {
echo 
"<a href=\"album1.php?P=$i\"><img src=\"resize.php?$files[$i]\" border=\"0\" align=\"right\" alt=\"\"></a>"
}
?>
</td>
        </tr>
<tr>
  <td>
  <?php 
  
if($i >= )
   {
echo
"Previous Image"
}
?>
</td>
  <td><div align="right">
  <?php
  
if($i sizeof($files))
   {
echo
"Next Image";
}
?>

</div></td>
</tr>
      </table>

<?php

}
?>

     

any help would be appreciated!
Thanks
« Last Edit: Jun 02, 2007, 04:34:21 PM by PHPNewbie-KY »
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8037
41179 credits
Members referred : 3



« Reply #1 on: Jun 02, 2007, 03:50:58 AM »

Is this page live somewhere?

What is the problem that you have?

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Supreme Overlord
***
Gender: Female
Posts: 148
1008 credits
Members referred : 0



« Reply #2 on: Jun 02, 2007, 04:20:37 AM »

It is live.  I will PM you the link.

It is not loading the pictures.  Little boxes come up but then they disappear. 
Supreme Overlord
***
Gender: Female
Posts: 148
1008 credits
Members referred : 0



« Reply #3 on: Jun 02, 2007, 04:40:22 PM »

Also, if you put in the address to take you to the pages, /album1.php?P=5 the pictures still aren't there, but if you click on show full screen it will take you to just the picture on the page....
Supreme Overlord
***
Gender: Female
Posts: 148
1008 credits
Members referred : 0



« Reply #4 on: Jun 07, 2007, 04:04:51 PM »

Does no one have any idea what it might be?  I have trouble shot everything I can think of.....
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8037
41179 credits
Members referred : 3



« Reply #5 on: Jun 07, 2007, 05:02:47 PM »

I just took a look to your script and it looks very bad coded.

The problem is probably in the resize2.php, not the script you posted. Check the directories if they are correct.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
Supreme Overlord
***
Gender: Female
Posts: 148
1008 credits
Members referred : 0



« Reply #6 on: Jun 07, 2007, 05:19:08 PM »

I have checked the directory.  I am looking into the resize issue.  I think you might be right & that is it. 

That is a code I got from someone else & made some changes.  For learning reasons can you tell me why it's bad?  I would like to know so I can fix the mistakes & not do it again.

BTW - that is not the code for the entire page, but just what I thought was relative to this discussion.
Supreme Overlord
***
Gender: Female
Posts: 148
1008 credits
Members referred : 0



« Reply #7 on: Jun 07, 2007, 05:28:44 PM »

It's fixed!

BTW - I know that goodlady is watching this post & this site.  Since you seem SO interested in this album & trying to hit it there will be a link to it from my camping page in a few minutes.
« Last Edit: Jun 08, 2007, 02:07:11 PM by PHPNewbie-KY »
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6309
38674 credits
Members referred : 374


It's time to use PHP5!


« Reply #8 on: Jun 07, 2007, 05:30:33 PM »

within this code there are too much php code jump in and outs, this way your server has much more to work, Check the net for articles about separating php code and html


Last blog : Is your website is down? Know before your visitors do!
Supreme Overlord
***
Gender: Female
Posts: 148
1008 credits
Members referred : 0



« Reply #9 on: Jun 07, 2007, 05:33:00 PM »

OK, thanks.  Do you think that might be b/c I only put part of the code up?  I am going to look into that though, I want my pages to load faster!  Thanks for your help!
Where are my glasses?
*
Posts: 21
138 credits
Members referred : 0


« Reply #10 on: Jul 20, 2007, 01:29:22 AM »

I would separate the code from the design.  A good way to do so is to use a template engine. Because the page doesn't change very often, you could cache the generated content. I can recommend HSTemplate: You can use PHP in your plugins and don't have to write pseudo code like it is in Smarty. HSTemplate is much faster than Smarty and many other template engines because the file is being incldued.
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6693
Tags : Photo Albums php Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Photo Album Problem
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Sep 05, 2008, 02:58:32 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 36.293
Total Topics: 7.476
Total Members: 3.898
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: 1Host

31 Guests, 3 Users online :

15 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.