Jump to content
celeroncillo

gallery_image_subdirectory_v1_0_1 (install PROBLEM)

Recommended Posts

Hello I have a clean installation of oscommerce 2.3.1 and I want install the gallery_image_subdirectory_v1_0_1 contribution (http://addons.oscommerce.com/info/7714). but ever show this error in my admin.

 

Warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\Servidor Web\www\virgen\admin\categories.php on line 624

 

(the line 624 of my categories.php is):

if (is_dir($path.$file) && !in_array($file,$exclude_folders)) $dir_array[] = preg_replace("/\/\//si", "/", $file);

 

I think that the readme.txt(included in contribution) is very simple or have any mistake.

 

My actions is:

install oscommerce 2.3.1

overwrite all files of the contribution (admin/categories.php) (admin\includes\functions\general.php) (admin\includes\languages\english\categories.php)

after it i´ve tried Delete the function in (admin/sec_dir_permissions.php) line 15 to 41 (function tep_opendir($path) {) TO (})

the problem continues , and I modify the (admin/includes/functions/general.php) adding after (tep_opendir($path);) around line 1481 this line :($dir = 'products/' . (tep_not_null($new_dir) ? $new_dir : $_POST['directory']);)

 

I use php5.

 

Please Can you help me (sorry for my bad english, I don´t speak it)

 

THANKS THANKS THANKS THANKS THANKS THANKS THANKS THANKS

Share this post


Link to post
Share on other sites

Hello,

 

My txt is not perfectly clear. i insert another.

 

1 - insert this function in categories.php

 



// gallery configuration
// Gallery

     $exclude_folders = array(); // folders to exclude from adding new images
     $root_images_dir = DIR_FS_CATALOG_IMAGES .'products/' ;
     $new_dir = preg_replace('/[^a-zA-Z0-9_.-]/i', '_',$HTTP_POST_VAR['new_directory']); 
     $dir = 'products/' . (tep_not_null($new_dir) ? $new_dir : $HTTP_POST_VAR['directory']);


 function tep_opendir($path) {
   $path = rtrim($path, '/') . '/';
   $exclude_array = array('.', '..', '.DS_Store', 'Thumbs.db','.php', '_note');
   $result = array();
   if ($handle = opendir($path)) {
     while (false !== ($filename = readdir($handle))) {
       if (!in_array($filename, $exclude_array)) {
         $file = array('name' => $path . $filename,
                       'is_dir' => is_dir($path . $filename),
                       'writable' => is_writable($path . $filename));
         $result[] = $file;
         if ($file['is_dir'] == true) {
           $result = array_merge($result, tep_opendir($path . $filename));
         }
       }
     }
     closedir($handle);
   }
   return $result;
 }   

 

2/ in sec dir, if you have deleted this function, re insert inside

 




 require('includes/application_top.php');

 function tep_opendir($path) {
   $path = rtrim($path, '/') . '/';

   $exclude_array = array('.', '..', '.DS_Store', 'Thumbs.db');

   $result = array();

   if ($handle = opendir($path)) {
     while (false !== ($filename = readdir($handle))) {
       if (!in_array($filename, $exclude_array)) {
         $file = array('name' => $path . $filename,
                       'is_dir' => is_dir($path . $filename),
                       'writable' => tep_is_writable($path . $filename));

         $result[] = $file;

         if ($file['is_dir'] == true) {
           $result = array_merge($result, tep_opendir($path . $filename));
         }
       }
     }

     closedir($handle);
   }

   return $result;
 }

 $whitelist_array = array();

 

 

3 - Delete the same function in includes/functions/general.php (tep_opendir($path)



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

 

Share this post


Link to post
Share on other sites

Also :

 

change tyhis categories.php

 

 

// Gallery	
         if (tep_not_null($new_dir)) {
           mkdir($path  . $new_dir, 0755, true);
           $separator = '/';
         }

 

 

 

by

 

 

// Gallery	


         if (tep_not_null($new_dir) && !is_dir($new_dir)) {
           mkdir($root_images_dir  . $new_dir, 0755, true);
           $separator = '/';
         }

 

 

 

and

 


<?php // place allowed sub-dirs in array, non-recursive
// Gallery
   $dir_array = array();

   if ($handle = opendir($path)) {							
     while (false !== ($file = readdir($handle))) {
       if ($file != "." && $file != "..") {
         if (is_dir($path.$file) && !in_array($file,$exclude_folders)) $dir_array[] = preg_replace("/\/\//si", "/", $file);
       }
     }
     closedir($handle);
     sort($dir_array);
   } else { 
     echo '<tr><td>' .TEXT_PRODUCTS_DIRECTORY_DONT_EXIST . ' ' . $path  .'<tr></td>';
   }

   $drop_array[0] = array('id' => '', 'text' => TEXT_PRODUCTS_IMAGE_ROOT_DIRECTORY);	

   foreach (tep_opendir($path) as $file) {   
     if ($file['is_dir']) {  
       $img_dir = substr($file['name'], strlen($path));
       $drop_array[] = array('id' => $img_dir, 'text' => $img_dir);   
     }   
   }

?>

 

 

 

by

 

 



<?php // place allowed sub-dirs in array, non-recursive

   $dir_array = array();
   foreach (tep_opendir($root_images_dir) as $file) {   
     if ($file['is_dir']) {  
       $img_dir = substr($file['name'], strlen($root_images_dir));
       $drop_array[] = array('id' => $img_dir, 'text' => $img_dir);   
     }   
   }

?>

 

 

i think that's all.

 

i upload another update soon.

 

Regards



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

 

Share this post


Link to post
Share on other sites

hello

excuse my bad english

I intall this very good addon and all is good.

Just the first image "Main Image (100 x 80px)" is not in "product/name of directory created in products

It is in "images"

 

The other images (large) are in the created directory

 

have you resolution for that

Thank's

Francois

Edited by francois21

Share this post


Link to post
Share on other sites

This module has been created only for the image gallery. You can try to customize this add on.



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

 

Share this post


Link to post
Share on other sites

I installed this contribution and it's working fine. But everytime you have to upload a file instead of just showing the destination where the file is already uploaded. So I found this tip in the forums.

http://forums.oscommerce.com/topic/68910-setting-upload-image-destination-in-categories-php/

 

De categories part is working, but I can't get the product images work with this contribution, it's to complicated for me.

Is there someone who can make the contribution and the tip work together?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×