Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old October 26th, 2003, 10:48 PM
Gabekun Gabekun is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 Gabekun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Problem with PHP Gallery tutorial

Hi... I'm new here, and quite new to php, and found this tutorial. It's really well written, but I have encountered a problem. My apologies if the the answer is obvious... but I can't seem to fix it.

Here are the two errors I get when trying to load the images.php file off my site:

Code:
Warning: OpenDir: No such file or directory (errno 2) in /usr/www/users/nb2436/pockynation/images.php on line 70

Warning: readdir(): supplied argument is not a valid Directory resource in /usr/www/users/nb2436/pockynation/images.php on line 71


Right, so I check those two lines to look for typing errors and whatnot, but they're identicial to the lines from the tutorial... here is the section of code where lines 70 and 71 are.

php Code:
Original - php Code
  1.  
  2. // get directory tree
  3. function directory($dir)
  4. {
  5.     $mydir = opendir($dir);
  6.     while(false !== ($file = readdir($mydir)))
  7.     {
  8.     if($file != "." && $file != "..")
  9.     {
  10.         if(is_dir($dir.$file))
  11.         {
  12.             chdir('.');
  13.         $tree[$file] = directory($dir.$file.'/');
  14.         chdir('..');
  15.         }
  16.         else
  17.         {
  18.         $size = getimagesize($dir.$file);
  19.         if(in_array($size['mime'], unserialize(TYPE)))
  20.             $tree[] = $file;
  21.         }
  22.     }
  23.     }
  24.     closedir($mydir);
  25.     return $tree;
  26. }
  27. $tree = directory(PATH);


The two specific lines are:

Line 70:
php Code:
Original - php Code
  1.  
  2.     $mydir = opendir($dir);


Line 71:
php Code:
Original - php Code
  1.  
  2.     while(false !== ($file = readdir($mydir)))


Can anyone see what the error is? Is it a problem with my site and not the code? Again, I'm sorry I am so stupid at php, as it is new to me... That's why I really liked this tutorial.. it explained stuff pretty well. Just baffled by this error

Any help would be apprecriated... thanks.

Reply With Quote
  #2  
Old October 27th, 2003, 05:27 AM
nazly nazly is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Colombo,SriLanka
Posts: 1,325 nazly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 18 sec
Reputation Power: 3
Send a message via Yahoo to nazly
RE: Problem with PHP Gallery tutorial

I don't think the error is in the code.. The error is in the arguments you send in. Check whether you have defined the path correctly as it in the tutorial according to your directory.

In config.php

define('PATH', '/inetpub/wwwroot/scripts/gallery/images/');

Here the path sould be the actual path, not the relative path.

Reply With Quote
  #3  
Old October 27th, 2003, 06:02 AM
Gabekun Gabekun is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 Gabekun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Problem with PHP Gallery tutorial

I had originally changed that to what I thought was correct (IE: /pockynation/images/nixxer, the directory with the images I wanted shown), however, changing it to include the complete structure found on the ftp (IE: usr/www/nb2436/pockynation/images/nixxer/) seems to have fixed the parse errors.. thank you for your help. I feel really stupid now because now I have another problem, that's probably just as obvious... the php works... kinda. It's showing a 'broken' image link in the center that's target is simply the folder (http://www.mysticdale.com/pockynation/images/nixxer), and not an image... even when I have multiple images in the folder, it only seems to be trying to display this single one, that really isn't an "image"

*sigh* many apologies for my newb-ness...

Reply With Quote
  #4  
Old October 27th, 2003, 06:43 AM
nazly nazly is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Colombo,SriLanka
Posts: 1,325 nazly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 18 sec
Reputation Power: 3
Send a message via Yahoo to nazly
RE: Problem with PHP Gallery tutorial

It is clearly stated in the tutorial that the filesystem is considers as the database. So only keep images in that folder.. Simple as that..

Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > Problem with PHP Gallery tutorial


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway