»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 07-21-2003, 02:51 PM   #1 (permalink)
Registered User
 
Join Date: Oct 2001
Location: Ooltewah, TN
Posts: 483
LittleKing is on a distinguished road
Send a message via Yahoo to LittleKing
Script stopped working after moving directory

I wrote a script that checks a folder for JPEG image files. Once it finds a valid image it check against another directory for a thumbnail of that image.

PHP Code:
$picturedir "/home/user/public_html/pictures";
$dir opendir($picturedir);

while (
$file readdir($dir)) {
  
$filetype = @getimagesize($file);
  if (
is_dir($file)) {
    echo 
"$file is a directory <br/>";
    continue;
  } elseif (
$filetype[2] != 2) {
    echo 
"$file is not a JPEG image. <br/>";
    continue;
  } 
//end if else if statement

  
$hasthumb check_for_thumb($file);
  if (
$hasthumb == false) {
    
$imagesizeinfo getimagesize($file);
    
resize_jpg($file150100);
    echo 
"RESIZED $file <br/>";
  }
// end while loop 
The script originally was in the same directory as the images were, but I wanted to move it back one directory. When I did the script stop correctly identify the JPEG images.

I don't understand why this is. Can anybody help me out?

I will gladly provide the extra function I have in the page, but the problem doesn't seem to be with those. It just doesn't correctly identify if it is an image.

Thanks
LK

LittleKing is offline   Reply With Quote
Old 07-21-2003, 09:13 PM   #2 (permalink)
Banned
 
qball's Avatar
 
Join Date: Oct 2001
Posts: 447
qball is on a distinguished road
I'll hack...

$picturedir = "/home/user/public_html/pictures";

Is not fully qualified path, so may be relative to directory in which the script runs. Though with PHP, probably relative, to PHP's default relative path...

Quote:
When I did the script stop correctly identify the JPEG images.
Does it identify other files properly?

Does it find thumbs, but not big file?

what dir did script and pics used to live, which leads to where is script now?

does it even get in while loop?

I can find out the supported datatypes in PHP. What you mean by image? As image/thumbnail probably same dt?
qball is offline   Reply With Quote
Old 07-22-2003, 04:49 AM   #3 (permalink)
Registered User
 
Join Date: Oct 2001
Location: Ooltewah, TN
Posts: 483
LittleKing is on a distinguished road
Send a message via Yahoo to LittleKing
Hey thanks a bunch qball. A had a friend look over the script for me and man do I fill stupid. He looked at it for a couple of minutues and said. "Oh, the getimageinfo as to be pointing to the correct directory."

So simple but I missed it.

Here is what I changed:
PHP Code:
  $filetype = @getimagesize($file); 
to
PHP Code:
  $filetype = @getimagesize("picutures/" $file); 
Again, thanks for the help.
LK
LittleKing is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 05:03 AM.