Because my church web site has a large number of contacts, I wanted to put all the photos in their own folder. Joomla's Contacts component normally expects photos to be stored at the default image location, /images/stories. I have a folder named portraits under this folder, but Joomla doesn't recurse into it when you select an image in the contact form.
It turns out that you have to make only three small edits to get this working, but I spent a frustrating few hours investigating before I found out how. To save you the trouble, here's the recipe. All file paths are relative to the Joomla root.
- Edit /components/com_contact/views/contact/tmpl/default.php. On line 52, change
<?php echo JHTML::_('image', 'images/stories' . '/'.$this->contact->image, ...
<?php echo JHTML::_('image', 'images/stories/portraits' . '/'.$this->contact->image, ...
- Edit /administrator/components/com_contact/admin.contact.php. On line 227, change
$lists['image'] = JHTML::_('list.images', 'image', $row->image );
$lists['image'] = JHTML::_('list.images', 'image', $row->image, NULL, '/images/stories/portraits/' );
- Edit /administrator/components/com_contact/admin.contact.html.php. On line 437, change
jsimg='../<?php echo $cparams->get('image_path'); ?>/' + ...
jsimg='../<?php echo $cparams->get('image_path'); ?>/portraits/' + ...
Afterwards, you will have to open each contact you've previously created and select the portrait anew. I did try doing a bulk edit by exporting the contacts table to CSV and globally replacing, but that was a dismal failure.
The Joomla maintainers are apparently part way through parameterising the location of the stories folder (see the call to get('image_path') above). Ideally the location of the portraits would be a separate parameter. I didn't have time to do this, but this investigation clearly reveals the places where the parameter would need to be used.