I’m using the sc_appmenu_add_item macro to create my menu. It works except for the icons. I have 2 icons, letter16.png, and letter16_new.png. the letter16.png icon shows up but on another item the letter16_new.png doesn’t show up. I’ve checked the file system and it exists with the others in /devel/conf/sys/img/ico. I can put the full path in the address bar and view the image. No mater what I put in the macro it won’t show up full path or not. I’ve cleared browser cache and did updatedb on the linux dev server. Why won’t it display!!!
I added a menu item in the menu item settings instead of using the macro. I used the image browser to select an image for the item. I ran the menu and the image shows up. I use inspect element in FF and the image path is looking at …/_lib/img/sys__NM__letter16_new.png. I never put it there! I didn’t use SC to upload the image. I used webmin to browse to the devel/conf/sys/img/ico folder and uploaded there. I NEVER uploaded it to the _lib dir!! What is going on!!! I went and checked /_lib/img and it’s not there!
Hi,
You can try this code :
//upload field is blob field
$id = 1;
$check_sql = “SELECT upload FROM upload WHERE id=$id”;
sc_lookup(rs, $check_sql);
if (isset({rs[0][0]}))
{
$image = {rs[0][0]};
}
$img = imagecreatefromstring($image);
imagejpeg($img, ‘…/_lib/img/simpletext.png’,100);
sc_image(‘simpletext.png’);
// now you can use this picture in menu
//sc_appmenu_add_item($menu,‘itm_7’,‘itm_0’,’ Child_Label’,‘simpletext.png’);
// this code was fine for my project
The documentation on the web regarding the icon path is incomplete - just an empty string! Please complete the documentation and the example on “https://www.scriptcase.net/tutorials/dynamic-menu/” with a valid custom icon path etc.
I have the same problem like ancr2001 - wasted about 2 hours to find out a path that makes no sense for a uploaded file via image manager.
Still have no solid / official solution what path to pass there.
Hi, is there a solution for this? The documentation still doesn’t appear to be updated on how to add icons. I have a work around but it’s not great.
There seems to be a process missing before or in the sc_appmenu_add_item function to add icons/images to menus dynamically. The problem seems to be that images do not get copied into the _lib/img/ folder unless they have been added by a scriptcase process. The sc_appmenu_add_item function does “not” copy over the images, hence it fails to add icons to the menu item.
In order to force the images into the img folder, I’ve had to create a dummy application and statically add the images to that application. These are then available to use using sc_appmenu_add_item in other menu applications.
Eg., I can use the following icon path ‘scriptcase__NM__ico__NM__alarmclock_pause_24.png’ in my dynamic menu, but I’ve also added it to the static dummy menu application.
The problem seems to be for all images in any location, public and project and their sub locations. If the image hasn’t be used prior to the above function, your image is not available.
Is there a missing macro that copies images? This thread is 7 / 8 years old now, is there a solution?
thanks,
Arthur
In case this helps anyone, I finally figured out just by chance how to do this the “correct” way. In the menu application, under application - - > settings, add your application icons. These then become available for your app, if you don’t do this, the icons will not be available in your menu application. In the sc_appmenu_add_item macro, simply reference the icons as you normally would when creating a static menu item (just copy and paste the icon name as if you were creating a static menu item). eg.
sys__NM__ico__NM__cancel32.png
or
sys__NM__ico__NM__book-rack.png