Project Help Wanted
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherProject Help Wanted

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 Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 15th, 2004, 09:05 AM
pezastic pezastic is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 pezastic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 27 sec
Reputation Power: 0
Can you point me in the right direction?

I'm trying to import images into an image gallery for my website. However, after the image is successfully uploaded, I receive the following error and am unable to access it in the gallery:

Quote:
Fatal error: Call to undefined function: process_images() in /path/to/gallery/import.php on line 312


Here is line 312, and beyond, of import.php:
PHP Code:
if ($images != null) {
            
$loaded process_images($images$path$request_vars);

            if (
$loaded >= 0) {
                echo 
"<p>" sprintf(translate("%s images loaded."), $loaded) . "</p>\n";
            }
            else {
                echo 
"<p>" translate("An error occurred.") . "</p>\n";
            }
        }

        if (
$tmp_path) {
            
system('rm -rf ' escapeshellarg($tmp_path));
        }

        
umask($oldumask);
    }
?>
<?php 
require_once("footer.inc.php"); ?> 


What could be the problem?

Last edited by pezastic : February 15th, 2004 at 09:08 AM.

Reply With Quote
  #2  
Old February 15th, 2004, 03:31 PM
Sadu Sadu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 7 Sadu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 42 sec
Reputation Power: 0
You have got a homemade function process_images() which you are calling. PHP is telling you that it doesn't know about this function, never heard of it.

Usually, functions reside in include files. Are you sure that you have linked to the relevant include file?

Reply With Quote
  #3  
Old February 16th, 2004, 05:00 AM
pezastic pezastic is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 pezastic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 27 sec
Reputation Power: 0
The beginning of import.php:

PHP Code:
<?php
    
require_once("include.inc.php");
    require_once(
"import.inc.php");


Then, import.inc.php, where the process_images function is:

PHP Code:
<?php

require_once("exif.inc.php");

function 
get_files($dir_name) {
    
$files = array();

    if (
$dir = @opendir($dir_name)) {
        while((
$file readdir($dir)) !== false) {
            if (
valid_image($file)) {
                
$files[] = $dir_name '/' $file;
            }
        }
        
closedir($dir);
    }
    else {
        echo 
translate("Could not open directory") . ": $dir_name<br>\n";
    }

    return 
$files;
}

function 
process_images($images$path$fields) {

    
$absolute_path IMAGE_DIR $path;

    
$thumb_path $absolute_path '/' THUMB_PREFIX;
    if (
file_exists($thumb_path) == false) {
        if (
mkdir($thumb_pathDIR_MODE)) {
            echo 
translate("Created directory") . ": $thumb_path<br>\n";
        }
        else {
            echo 
translate("Could not create directory") . ": $thumb_path<br>\n";
            return -
1;
        }
    }

    
$mid_path $absolute_path '/' MID_PREFIX;
    if (
file_exists($mid_path) == false) {
        if (
mkdir($mid_pathDIR_MODE)) {
            echo 
translate("Created directory") . ": $mid_path<br>\n";
        }
        else {
            echo 
translate("Could not create directory") . ": $mid_path<br>\n";
            return -
1;
        }
    }

    echo 
"<p>" sprintf(translate("Processing %s image(s)."), count($images)) . "</p>\n";
    
$loaded 0;
    foreach (
$images as $image) {

        if (
file_exists($image) == false) {
            echo 
sprintf(translate("Skipping %s: File does not exist."), $image) . "<br>\n";
            continue;
        }

        
$image_dir dirname($image);
        
$image_name basename($image);

        if (
$image_dir != $absolute_path) {
            
$new_image $absolute_path '/' $image_name;
            if (!
copy($image$new_image)) {
                echo 
sprintf(translate("Could not copy %s to %s."), $image$new_image) . "<br>\n";
                continue;
            }

            echo 
"$image -> $new_image<br>\n";

            
$image $new_image;
        }
        else {
            echo 
"$image<br>\n";
        }

        
flush();

        
$photo = new photo();
        
$photo->set("name"$image_name);
        
$photo->set("path"$path);

        
//$width = imagesx($img_src);
        //$height = imagesy($img_src);
        
$image_info getimagesize($image);
        
$width $image_info[0];
        
$height $image_info[1];

        if (!
$photo->thumbnail()) {
            echo 
translate("Could not create thumbnail") . ": $image_name<br>\n";
        }

        
// first try the insert
        
if ($photo->insert()) {

            
// then do everything else as an update
            // (which is smart enough to handle the
            // album/category/people tables)

            
$photo->set("size"filesize($image));
            
$photo->set("width"$width);
            
$photo->set("height"$height);

            if (
$fields) {
                
$photo->set_fields($fields);
            }

            
// exif functions introduced in PHP 4.2.0
            
if (minimum_version('4.2.0')) {
                
$exif_data process_exif($image);
                
$photo->set_fields($exif_data);
            }

            
$photo->update($fields);

            
$loaded++;
        }
        else {
            echo 
translate("Insert failed.") . "<br>\n";
        }

    }

    return 
$loaded;
}

?>


What could be causing the error message?

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherProject Help Wanted > Can you point me in the right direction?


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


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





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