I'm searching a way to define a default intro image in the Joomla article creator from the core (when a user create an article if he don't add an intro image there is one by default generated from a file in my server).

  • Template override of com_content
  • Inject into something like :
IF content.images.length == 0 
show default image
run normal code for displaying content images

Thanks to haydenyoung on Gitter for his help.

1 Answer 1


You would want to put this as a template override for com_content. Depending on whether you want it to appear on the category page or single article, the file would go /templates/TEMPLATE_NAME/html/com_content/category/blog_item.php /templates/TEMPLATE_NAME/html/com_content/article/default.php

I would make a clone of existing view and then add code below to get the intro image:

$images  = json_decode($this->item->images);
$intro_image = $images->image_intro;

this is check if empty and display:

if($intro_image !== '') {
       echo JLayoutHelper::render('joomla.content.intro_image', $this->item);

} else { ?>
       <div class="pull-left item-image">
            <img src="images/whatever/is/your/default.jpg" alt="something" itemprop="thumbnailUrl"/>

<?php } ?>

I didn't have time to test, so if there is an issue, comment and I will update my answer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.