Thomas. Posted August 28, 2018 Posted August 28, 2018 Hi, After finally completing version 1 of my application, I installed it on my production site. Everything works fine, except for my images. They appear to have been added to my uploads/set_resources_2 folder, but they do not show up anywhere where they are supposed to show. The source of the page just shows this: <img src="">. It works fine on my development installation. Here's an example from one of my template files showing how I include the images: <img src='{resource="Skins\Skin_{$character->model}.png" app="charmanager" location="global"}'> Any ideas what's going on here?
bfarber Posted August 29, 2018 Posted August 29, 2018 Variables inside the template plugin tag aren't really reliable (or more specifically, shouldn't be encapsulated in curly braces). If you hardcode a value for $character->model instead, does it work? If so, then your solution will be to assign the entire resource value to a variable and pass that like so {{$resourceName = "Skins\Skin_" . $character->model . ".png"}} {resource="$resourceName" app="charmanager" location="global"} If that does not solve the issue, check all of your themes in the AdminCP and verify under the Manage Resources page that your resources were correctly imported to each theme, then run the support tool to clear your caches and verify if the issue persists.
Thomas. Posted August 29, 2018 Author Posted August 29, 2018 Hardcoding a value does not seem to work either. The images do show up in my theme resources... Clearing the cache also didn't do the trick. This is strange...
Adriano Faria Posted August 29, 2018 Posted August 29, 2018 The image(s) must be placed on \applications\your_app\dev\resources\front\ folder. Are they there?
Thomas. Posted August 29, 2018 Author Posted August 29, 2018 Yes, well in \global. They have their own subdirectory below \global, but that shouldn't be an issue I guess?
Adriano Faria Posted August 29, 2018 Posted August 29, 2018 I would try front. Global seems to be OK too: https://invisioncommunity.com/4guides/themes-and-customizations/advanced-theming/managing-resources-r129/
Thomas. Posted August 29, 2018 Author Posted August 29, 2018 I've also checked the database (core_theme_resources) just to be sure, and everything looks okay there as well. So to summarize: The files are there where they should be; They are correctly listed in the database; They show up in the AdminCP under theme resources; The value that defines what image to use is now hardcoded in the template file ...and it still does not work. Could it be some kind of obscure caching issue somewhere? I'm running out of ideas...
newbie LAC Posted August 29, 2018 Posted August 29, 2018 14 hours ago, Thomas. said: <img src='{resource="Skins\Skin_{$character->model}.png" app="charmanager" location="global"}'> Hello, Why do you use backslash? Skins\Skin
Adriano Faria Posted August 29, 2018 Posted August 29, 2018 Sorry, out of ideas too. I use it like that: <img src='{resource="crowdfunding.jpg" app="crowdfunding" location="front"}' class="ipsThumb crowdfundingImage"> The images is placed, in this case, on \applications\crowdfunding\dev\resources\front\: and it works fine:
Thomas. Posted August 29, 2018 Author Posted August 29, 2018 2 minutes ago, newbie LAC said: Hello, Why do you use backslash? Skins\Skin You... you are magnificent! So I changed it to a forward slash and voila, it works! I guess it's just the force of habbit for me to use a backslash, especially when developing when you use lots of them for namespacing. Thank you!
Adriano Faria Posted August 29, 2018 Posted August 29, 2018 Such a small detail... Good catch for @newbie LAC. 👏
Recommended Posts
Archived
This topic is now archived and is closed to further replies.