Hi! I’m having troubles trying to get access to an image that is not in the folder of the theme. I want to stock the images in the packages folder so that I can access them from all the themes, but I can’t find a way to do that.
I tried to use getPackagePath() but I get this error: Call to undefined method Concrete\Core\Page\View\PageView::getPackagePath().
Also, if I write the simple path (/var/www/html/concrete5/packages/uploadsImages/name_image) it doesn’t find the image. If I check the console, I can see that it search for the image just in the theme folder, it doesn’t go up to the package folder.
Any idea of what I can do? Thanks a lot in advance!
PS:
/var/www/html/concrete5/packages/uploadsImages/name_image → path for the image
/var/www/html/concrete5/packages/cherche/themes/theme_cherche → theme path
you could try using an absolute path like:
https://yourdomain.com/packages/theme-name/images/your-image.png
When I try this it still doesn’t work and in the console it gives me this error: Failed to load resource: the server responded with a status of 404 (Not Found).
Any idea why? It also gave the same error if I write the path without the domain.
You need to be very sure of your images for this. Unless you get complicated, showing images directly out of a package folder bypasses all the thumbnail mechanisms and picture element building the core provides.
You maybe know another way to do it?
For most applications, I would import them into the file manager during install, record the fIDs, then use the same mechanisms the core blocks use to display them. A bonus would be the images would be available to all uses, not just the coded uses.
For themes or theme-like applications, where I was managing everything to do with the file size, such as fixed banner images, then as themes do to show images bundled with the theme.