Hi. I am using the smart image resizer script from http://averagecoder.net/resize-or-crop-your-wordpress-post-level-images-with-customizable-size-using-smart-image-resizer.htm and the new, resized images are not appearing. Since the script is pre-written, the only things I need to change are the temporary cache directory and the 2 paths in the image html code. Therefore, I know the problem has to lay with the path identification, but I tried every combination I can think of and I can't even get an error to display to help troubleshoot this.

I have an image, loveseat.jpg, placed in /testing/portfolio/labels/ and my img code running in /testing/ is

print("<img src=\"/portfolio/labels/image.php/newlabel?width=50&amp;height=50&amp;cropratio=1:1&amp;image=/portfolio/labels/$label\" alt=\"label for $bottle\" hspace=\"4\" vspace=\"4\" /><br />")

image.php is saved in /testing/portfolio/labels/ and the only code to revise is

define('CACHE_DIR_NAME',		'/thumbs/');

where /thumbs/ is a folder placed in /testing/portfolio/labels/

I don't even think image.php is being called because a test print("here"); doesn't reveal anything.

Your help is much appreciated.

The testing site is here - http://www.winesoffranceinc.com/testing/content.php?page=Portfolio

    taking a quick look at the page supplied your not testing it how the author suggests. Your way is never going to work.

      The only difference between the author's instructions and my code is that I used /portfolio/labels/ instead of /wp-content/uploads/. Are there other differences that you noticed?

        I think I found one of the problems - the defined cache directory in image.php should be the path from the root, not the complete path starting with /home7/winesof/....

        The other interesting thing is that if I call http://www.winesoffranceinc.com/testing/portfolio/labels/image.php there is an error. I even tried removing all of the code and replacing it with a simple html header and it doesn't work. Any ideas?

        part of image.php code:

        if (!isset($_GET['image']))
        {
        	header('HTTP/1.1 400 Bad Request');
        	echo 'Error: no image was specified';
        	exit();
        }
        
        define('MEMORY_TO_ALLOCATE',	'100M');
        define('DEFAULT_QUALITY',		90);
        define('CURRENT_DIR',			dirname(__FILE__));
        define('CACHE_DIR_NAME',		'/testing/portfolio/labels/thumbs/');
        define('CACHE_DIR',				CURRENT_DIR . CACHE_DIR_NAME);
        define('DOCUMENT_ROOT',			$_SERVER['DOCUMENT_ROOT']);
        
        // Images must be local files, so for convenience we strip the domain if it's there
        $image			= preg_replace('/^(s?f|ht)tps?:\/\/[^\/]+/i', '', (string) $_GET['image']);
        
        // For security, directories cannot contain ':', images cannot contain '..' or '<', and
        // images must start with '/'
        if ($image{0} != '/' || strpos(dirname($image), ':') || preg_match('/(\.\.|<|>)/', $image))
        {
        	header('HTTP/1.1 400 Bad Request');
        	echo 'Error: malformed image path. Image paths must begin with \'/\'';
        	exit();
        }
        
        // If the image doesn't exist, or we haven't been told what it is, there's nothing
        // that we can do
        if (!$image)
        {
        	header('HTTP/1.1 400 Bad Request');
        	echo 'Error: no image was specified';
        	exit();
        }
        
        // Strip the possible trailing slash off the document root
        $docRoot	= preg_replace('/\/$/', '', DOCUMENT_ROOT);
        
        if (!file_exists($docRoot . $image))
        {
        	header('HTTP/1.1 404 Not Found');
        	echo 'Error: image does not exist: ' . $docRoot . $image;
        	exit();
        }
        
        // Get the size and MIME type of the requested image
        $size	= GetImageSize($docRoot . $image);
        $mime	= $size['mime'];
        
        // Make sure that the requested file is actually an image
        if (substr($mime, 0, 6) != 'image/')
        {
        	header('HTTP/1.1 400 Bad Request');
        	echo 'Error: requested file is not an accepted type: ' . $docRoot . $image;
        	exit();
        }
        
        $width			= $size[0];
        $height			= $size[1];
        
        $maxWidth		= (isset($_GET['width'])) ? (int) $_GET['width'] : 0;
        $maxHeight		= (isset($_GET['height'])) ? (int) $_GET['height'] : 0;
        
        if (isset($_GET['color']))
        	$color		= preg_replace('/[^0-9a-fA-F]/', '', (string) $_GET['color']);
        else
        	$color		= FALSE;
        
        if (!$maxWidth && $maxHeight)
        {
        	$maxWidth	= 99999999999999;
        }
        elseif ($maxWidth && !$maxHeight)
        {
        	$maxHeight	= 99999999999999;
        }
        elseif ($color && !$maxWidth && !$maxHeight)
        {
        	$maxWidth	= $width;
        	$maxHeight	= $height;
        }
        
        
        if ((!$maxWidth && !$maxHeight) || (!$color && $maxWidth >= $width && $maxHeight >= $height))
        {
        	$data	= file_get_contents($docRoot . '/' . $image);
        
        $lastModifiedString	= gmdate('D, d M Y H:i:s', filemtime($docRoot . '/' . $image)) . ' GMT';
        $etag				= md5($data);
        
        doConditionalGet($etag, $lastModifiedString);
        
        header("Content-type: $mime");
        header('Content-Length: ' . strlen($data));
        echo $data;
        exit();
        }
        
        
        
          Write a Reply...