morgandebray Posted April 1, 2020 Share Posted April 1, 2020 (edited) Hi, I've created a mega menu for my website. I've also added an image to the "menu thumbnail" input. So this is where the file is located : http://mywebsite.com/img/tmp/category_13-0_thumb.jpg?time=1585727749 I'm overriding the ps_mainmenu.php file in order to add some data to my item menu. I'm trying to get the image thanks to this, but it's always returning an empty array : $files = scandir(_PS_TMP_IMG_DIR_); // $files = scandir(_PS_CAT_IMG_DIR_); if (count(preg_grep('/^'.$category['id_category'].'-([0-9])?_thumb.jpg/i', $files)) > 0) { foreach ($files as $file) { if (preg_match('/^'.$category['id_category'].'-([0-9])?_thumb.jpg/i', $file) === 1) { $image_url = $this->context->link->getMediaLink(_THEME_CAT_DIR_.$file); $thumbnail[] = $image_url; } } } I'm working on PS 1.7. Edited April 1, 2020 by morgandebray (see edit history) 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