Changeset 278 for trunk


Ignore:
Timestamp:
Aug 1, 2007 3:44:58 AM (17 years ago)
Author:
quinn
Message:

Fixed web-uploaded image thumbnailing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/ImageThumb.inc.php

    r256 r278  
    345345        // Ensure destination directories are created. This will only be called once per page load.
    346346        if (!$this->_createDestDirs()) {
     347            $app->logMsg('Image resizing failed: unable to create dest dirs.', LOG_WARNING, __FILE__, __LINE__);
    347348            return false;
    348349        }
     
    761762                return false;
    762763            }
    763        
     764
    764765            // Loop through specs and ensure all dirs are created.
    765766            foreach ($this->_image_specs as $spec) {
     
    776777                }
    777778                if (!file_exists($dest_dir)) {
     779                    $app->logMsg(sprintf('Creating dest dir: %s', $dest_dir), LOG_DEBUG, __FILE__, __LINE__);
    778780                    if (phpversion() > '5') {
    779781                        // Recursive.
     
    785787                        // Recursive mkdir for php 4.
    786788                        $path = '';
     789                        $depth = 0;
     790                        $ret = true;
    787791                        foreach (array_diff(explode('/', $dest_dir), array('')) as $dir) {
    788792                            $path .= '/' . $dir;
    789                             if (! ($ret = file_exists($path) ? true : mkdir($path, $this->getParam('dest_dir_perms')))) {
     793                            $depth++;
     794                            /// FIXME: This is a dirty way to make this work when open_basedir prevents looking at the first 3 directories in an absolute path.
     795                            if ($depth > 3 && !($ret = file_exists($path) ? true : mkdir($path, $this->getParam('dest_dir_perms')))) {
    790796                                $return_val++;
    791797                                $app->logMsg(sprintf('mkdir failure: %s', $path), LOG_ERR, __FILE__, __LINE__);
    792798                                break;
     799                            } else {
     800                                $app->logMsg(sprintf('mkdir attempt: %s', $path), LOG_DEBUG, __FILE__, __LINE__);
    793801                            }
    794802                        }
     
    798806                        $app->logMsg(sprintf('mkdir success: %s', $dest_dir), LOG_DEBUG, __FILE__, __LINE__);                       
    799807                    }
     808                } else {
     809                    $app->logMsg(sprintf('Dest dir exists: %s', $dest_dir), LOG_DEBUG, __FILE__, __LINE__);
    800810                }
    801811            }
Note: See TracChangeset for help on using the changeset viewer.