Get the path of an image uploaded through C5 interface
I am trying to implement a certain image, that is changeable through the C5 interface. I was thinking of giving a div element an inline style, with PHP getting the path of the (background)image. The image is uploaded via C5 dashboard with a specific name. How can I get path of this image?
I am trying to make a theme with the capability of dynamically changeable images, which can be easily changed by uploading an image with a specific filename - ofcourse, this means the filenames are unique. Would you perhaps know a way to achieve this, too?
1. Use something like
<img src="<?php echo $this->getThemePath()?>/image/photofilename.png">
2. Use a piece of code like <img src="<?php echo($page->getAttribute('page_image')->getVersion()->getRelativePath());?>" >. The disadvantage to this is you would need to add a page_image attribute to the page before an image would show up. You could also use
This would load a default image stored in the template if no page_image attribute were specified.
A stack get updated on all pages at the same time.
After an install you have the concrete dir with a bunch of empty dir's and then another concrete dir with stuff in them. Then you have the whole numbered directories where images are buried for some reason. Why do you not have a main images directory for content? Are the empty dir's at the top for putting in overides for the ones below?
First, where you want the image to display in the template add this:
$img = Block::getByName('Image Block Name'); if( is_object($img) ) $img->display();
Then go to the dashboard and create a image block in the scrapbook named 'Image Block Name' or whatever the name is of the block you are selecting with Block::getByName(). The image block should then be displayed in the template wherever the code above is inserted.