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, 11: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, 06: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: 4
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, 07: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, 07: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: 4
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!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

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




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek