Zen Cart Logo
Forums / General Questions / Additional Product Images not displaying

Additional Product Images not displaying

Views: 854

Results 1 to 7 of 7
15 Apr 2016, 7:42 PM
#1
apogeerockets avatar

apogeerockets

Zen Follower

Join Date:
Aug 2011
Posts:
104
Plugin Contributions:
0

Additional Product Images not displaying

My additional images stopped showing up at some point.... best I can trace it to is that the directory isn't reading?

I added some debug code to the additional_images folder.

$d = $products_image_directory;
	echo $d.'<br />';

	// Open a known directory, and proceed to read its contents
	if (is_dir($d)) {
			echo "is a directory."."\n";
	    if ($dh = opendir($d)) {
	        while (($file = readdir($dh)) !== false) {
	            echo "filename: $file : filetype: " . filetype($d . $file) . "\n";
	        }
	        closedir($dh);
	    }
	}
	
	$d = @dir($products_image_directory) or die("getFileList: Failed opening directory $products_image_directory for reading");

which results in...

"/images/apogee_products/
getFileList: Failed opening directory /images/apogee_products/ for reading"

Now, if i add "DIR_FS_CATALOG." to the code (just above the debug)...

$products_image_directory = str_replace($products_image, '', substr($products_image, strrpos($products_image, '/')));
  if ($products_image_directory != '') {
    $products_image_directory = DIR_FS_CATALOG.DIR_WS_IMAGES . str_replace($products_image_directory, '', $products_image) . "/";
  } else {
    $products_image_directory = DIR_FS_CATALOG.DIR_WS_IMAGES;
  }

it gives me the directory /home/***/public_html/beta//images/apogee_products/ which then actually reads as a directory and proceeds with the code, and finds the appropriate additional images. But, it's got that // after beta since DIR_FS_CATALOG ends with a slash and DIR_WS_IMAGES begins with one, which then causes the display image path to be wonky and results in broken images.

Modules installed that may affect things:
IH4
Zen Lightbox 1.7.0 (seems to work fine)
Edify template from themeforest

All file/folder permissions for /images are set to 755.

Some of my main product images are also tiny (using the small size instead of the medium), but I haven't looked into that enough to give you guys more info.

ApogeeRockets.com
beta.apogeerockets.com <-- where i've been testing the above code

15 Apr 2016, 7:48 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Additional Product Images not displaying

DIR_WS_IMAGES should not start with a /...
Remove it and your problem should be solved.

15 Apr 2016, 8:01 PM
#3
apogeerockets avatar

apogeerockets

Zen Follower

Join Date:
Aug 2011
Posts:
104
Plugin Contributions:
0

Re: Additional Product Images not displaying

mc12345678:

DIR_WS_IMAGES should not start with a /...
Remove it and your problem should be solved.

There was a / in the DIR_WS_CATALOG configure, which when I removed, resolved the images problem (that configure also affects DIR_WS_IMAGES).

15 Apr 2016, 8:07 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Additional Product Images not displaying

apogeerockets:

There was a / in the DIR_WS_CATALOG configure, which when I removed, resolved the images problem (that configure also affects DIR_WS_IMAGES).

It affects a lot more than that and if you review the notes of at least any recent includes/configure.php file will see that the DIR_WS_CATALOG is supposed to end with a slash... take a look at includes/dist-configure.php for an example of how the DIR_WS_ constants are structured...

18 Apr 2016, 6:28 PM
#5
apogeerockets avatar

apogeerockets

Zen Follower

Join Date:
Aug 2011
Posts:
104
Plugin Contributions:
0

Re: Additional Product Images not displaying

mc12345678:

It affects a lot more than that and if you review the notes of at least any recent includes/configure.php file will see that the DIR_WS_CATALOG is supposed to end with a slash... take a look at includes/dist-configure.php for an example of how the DIR_WS_ constants are structured...

Yeah, it only works on my beta site -- not the live?? So, obviously that is not the solution.

18 Apr 2016, 6:36 PM
#6
apogeerockets avatar

apogeerockets

Zen Follower

Join Date:
Aug 2011
Posts:
104
Plugin Contributions:
0

Re: Additional Product Images not displaying

Found it. There was a DIR_WS_CATALOG before my images/ folder. I have no idea when that got accidentallly pasted in? Removing that fixed it.

  define('DIR_WS_IMAGES', DIR_WS_CATALOG.'images/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
  define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/');
  define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/');
19 Apr 2016, 10:47 AM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Additional Product Images not displaying

Couldn't tell ya of course. :)

Glad the appropriate fix worked and that back in picture showing business. :)