Guest Posted January 29, 2011 Share Posted January 29, 2011 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 Quote Link to comment Share on other sites More sharing options...
Guest Posted January 30, 2011 Share Posted January 30, 2011 That's precisely my problem. Hope you can help us. Thank you in advance. Quote Link to comment Share on other sites More sharing options...
♥Gyakutsuki Posted February 5, 2011 Share Posted February 5, 2011 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) foxp2 1 Quote Regards ----------------------------------------- Loïc Contact me by skype for business Contact me @gyakutsuki for an answer on the forum Link to comment Share on other sites More sharing options...
♥Gyakutsuki Posted February 5, 2011 Share Posted February 5, 2011 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 foxp2 1 Quote Regards ----------------------------------------- Loïc Contact me by skype for business Contact me @gyakutsuki for an answer on the forum Link to comment Share on other sites More sharing options...
francois21 Posted February 6, 2011 Share Posted February 6, 2011 (edited) 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 February 6, 2011 by francois21 Quote Link to comment Share on other sites More sharing options...
♥Gyakutsuki Posted February 6, 2011 Share Posted February 6, 2011 This module has been created only for the image gallery. You can try to customize this add on. foxp2 1 Quote Regards ----------------------------------------- Loïc Contact me by skype for business Contact me @gyakutsuki for an answer on the forum Link to comment Share on other sites More sharing options...
jamesadamo Posted February 6, 2011 Share Posted February 6, 2011 Thank you very much Gyakutsuki! I will apply this new instruction and let you know the results. Quote Link to comment Share on other sites More sharing options...
Clau123 Posted October 17, 2012 Share Posted October 17, 2012 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://www.oscommerce.com/forums/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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.