Keyword

Insert a standard pics to all new items in a categorie

  • Litho-Verlag e.K.
  • Litho-Verlag e.K.'s Avatar Topic Author
  • Offline
  • Senior Member
More
3 years 5 months ago #177440 by Litho-Verlag e.K.
Hi,
I would like to know how can I insert a standard picture to al new articles which will be used if the author doesn't load up his picture. shortly said: No picture for upload K2 use a standard pic.
Thanks for your help
Regards
litho

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #177447 by JoomlaWorks
Override item.php. Check if $this->item->image is set and if it's not (no image), output a custom src path.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Litho-Verlag e.K.
  • Litho-Verlag e.K.'s Avatar Topic Author
  • Offline
  • Senior Member
More
3 years 5 months ago #177453 by Litho-Verlag e.K.
Replied by Litho-Verlag e.K. on topic Insert a standard pics to all new items in a categorie
Hi Fotis,
thanks for your answer, but I'm not a coder :-(

I believe you mean that paragraph in the item.php:

<?php if($this->item->params->get('itemImage') && !empty($this->item->image)): ?>
<!-- Item Image -->
<div class="itemImageBlock">
<span class="itemImage">
<a data-k2-modal="image" href="<?php echo $this->item->imageXLarge; ?>" title="<?php echo JText::_('K2_CLICK_TO_PREVIEW_IMAGE'); ?>">
<img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
</a>
</span>

<?php if($this->item->params->get('itemImageMainCaption') && !empty($this->item->image_caption)): ?>
<!-- Image caption -->
<span class="itemImageCaption"><?php echo $this->item->image_caption; ?></span>
<?php endif; ?>

<?php if($this->item->params->get('itemImageMainCredits') && !empty($this->item->image_credits)): ?>
<!-- Image credits -->
<span class="itemImageCredits"><?php echo $this->item->image_credits; ?></span>
<?php endif; ?>

<div class="clr"></div>

But now to get more I'm out... Could you please help me? Thanks.

Another wish from me is, a to random a pic from a folder, so that you don't find always the same pic by the articles. But if there is only one pic inside the folder it is as it is...

regards
litho

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #177460 by JoomlaWorks
Replace the default block in item.php:
        <?php if($this->item->params->get('itemImage') && !empty($this->item->image)): ?>
        <!-- Item Image -->
        <div class="itemImageBlock">
            <span class="itemImage">
                <a data-k2-modal="image" href="<?php echo $this->item->imageXLarge; ?>" title="<?php echo JText::_('K2_CLICK_TO_PREVIEW_IMAGE'); ?>">
                    <img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
                </a>
            </span>

            <?php if($this->item->params->get('itemImageMainCaption') && !empty($this->item->image_caption)): ?>
            <!-- Image caption -->
            <span class="itemImageCaption"><?php echo $this->item->image_caption; ?></span>
            <?php endif; ?>

            <?php if($this->item->params->get('itemImageMainCredits') && !empty($this->item->image_credits)): ?>
            <!-- Image credits -->
            <span class="itemImageCredits"><?php echo $this->item->image_credits; ?></span>
            <?php endif; ?>

            <div class="clr"></div>
        </div>
        <?php endif; ?>

with:
        <?php if($this->item->params->get('itemImage')): ?>
        <!-- Item Image -->
        <div class="itemImageBlock">
            <span class="itemImage">
                <a data-k2-modal="image" href="<?php echo $this->item->imageXLarge; ?>" title="<?php echo JText::_('K2_CLICK_TO_PREVIEW_IMAGE'); ?>">
                	<?php if (empty($this->item->image)): ?>
                	<img src="/path/to/placeholder/image" alt="Placeholder text" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
                	<?php else: ?>
                    <img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
                    <?php endif; ?>
                </a>
            </span>

            <?php if($this->item->params->get('itemImageMainCaption') && !empty($this->item->image_caption)): ?>
            <!-- Image caption -->
            <span class="itemImageCaption"><?php echo $this->item->image_caption; ?></span>
            <?php endif; ?>

            <?php if($this->item->params->get('itemImageMainCredits') && !empty($this->item->image_credits)): ?>
            <!-- Image credits -->
            <span class="itemImageCredits"><?php echo $this->item->image_credits; ?></span>
            <?php endif; ?>

            <div class="clr"></div>
        </div>
        <?php endif; ?>

Also replace /path/to/placeholder/image with your actual placeholder image.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum