adller99 Posted October 18, 2015 Share Posted October 18, 2015 Hi there, when id_image is 32 it store pictures at /img/p/3/2 where is it going to store them if id_image is for example 158 and 2356? Cheers, Adam Link to comment Share on other sites More sharing options...
Darknoe Posted October 18, 2015 Share Posted October 18, 2015 (edited) I made this simple code to retrieve all images from products or categories, it may help you on your question: function getProductImage($id_image){ $base_url = url(); $base_url .= 'img/p/'; $id_image_array = str_split($id_image); for($i=0;$i<count($id_image_array);$i++){ $base_url .= $id_image_array[$i].'/'; } $base_url .= $id_image.'-large_default.jpg'; return $base_url; } function getCategoryImage($id_image){ $base_url = url(); $base_url .= 'img/c/'; $base_url .= $id_image.'-medium_default.jpg'; return $base_url; } function url(){ $base_url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; if(isset($_SERVER['HTTPS'])){ $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; } else{ $protocol = 'http'; } $base_url = explode('?', $base_url); return $base_url[0]; } Edited October 18, 2015 by Darknoe (see edit history) Link to comment Share on other sites More sharing options...
adller99 Posted October 18, 2015 Author Share Posted October 18, 2015 I made this simple code to retrieve all images from products or categories, it may help you on your question: function getProductImage($id_image){ $base_url = url(); $base_url .= 'img/p/'; $id_image_array = str_split($id_image); for($i=0;$i<count($id_image_array);$i++){ $base_url .= $id_image_array[$i].'/'; } $base_url .= $id_image.'-large_default.jpg'; return $base_url; } function getCategoryImage($id_image){ $base_url = url(); $base_url .= 'img/c/'; $base_url .= $id_image.'-medium_default.jpg'; return $base_url; } function url(){ $base_url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; if(isset($_SERVER['HTTPS'])){ $protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http"; } else{ $protocol = 'http'; } $base_url = explode('?', $base_url); return $base_url[0]; } well, it doesn't. Cause I dont see what the input + output is. Can you tell me whether is gonna creating folders like this id_image = 235 so it'll create \img\p\23\5 ? thanks Link to comment Share on other sites More sharing options...
Darknoe Posted October 18, 2015 Share Posted October 18, 2015 (edited) well, it doesn't. Cause I dont see what the input + output is. Can you tell me whether is gonna creating folders like this id_image = 235 so it'll create \img\p\23\5 ? thanks If you follow the method flow you will get this: $img_src = geProductImage(235); echo $img_src; --> www.yourbasepath.com/img/p/2/3/5/235-large_default.jpg So your new folder will be img/p/2/3/5/ Edited October 18, 2015 by Darknoe (see edit history) Link to comment Share on other sites More sharing options...
adller99 Posted October 18, 2015 Author Share Posted October 18, 2015 If you follow the method flow you will get this: $img_src = geProductImage(235); echo $img_src; --> www.yourbasepath.com/img/p/2/3/5/235-large_default.jpg So your new folder will be img/p/2/3/5/ I guess, you are pretty possitive about it, right? Link to comment Share on other sites More sharing options...
bellini13 Posted October 19, 2015 Share Posted October 19, 2015 where is it going to store them if id_image is for example 158 and 2356? img/p/1/5/8/ img/p/2/3/5/6/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now