Hey,
I’m trying to add an image to a subpage, and getting some odd URLs being returned. Here’s my file structure (shown as the content folder sorts it):
- About us
- The team
- Person 1
person1.jpg
person.txt
In my ‘person’ blueprint, I’ve got an ‘image’ input for selecting a file to use as the profile image. This all seems to work fine. However, when I try to use the image in the template as follows, it doesn’t work:
<?php foreach($page->children() as $subpage): ?>
<div class="col-sm-4 col-md-3">
<?php if($image = $subpage->profile_image()->to_file()): ?>
<img src="<?php echo $image->url(); ?>" class="img-responsive">
<?php endif; ?>
<h3><?php echo $subpage->title(); ?></h3>
<h4 class="light-header h5"><?php echo $subpage->jobtitle(); ?></h4>
</div>
<?php endforeach; ?>
The title and jobtitle fields are fetched fine, but the image returns a url without the full structure (e.g. instead of xyz.com/about-us/the-team/person1.jpg
it returns xyz.com/person1.jpg
.
Any thoughts on what’s going on here?