Printing an image to the bottom of each page using TCPDF? - pdf-generation

is there a way to print an image to the bottom of each page? Some sort of footer alternative so to say. My image code looks like that right now:
'<p><img src="' . $footerImage . '" /></p>';
Is that possible? If not, is it possible to print an image to the tcpdf footer?
Thanks!

If your using Php you'd echo out $footerImage and have a separate php included file with $footerImage pointed to the absolute footer image location. So for example:
home.php:
<?php include('vd.php'); ?>
<p><img src="<?php echo $footerImage; ?>" /></p>
vd.php:
<?php $footerImage = 'app/view/img1.html'; ?>
Is this of any help?

Related

Implementing a simple lightbox in Joomla 4

I am trying to transition to Joomla 4.
I have been using <?php JHTML::_('behavior.modal'); ?> in my index.php template.
Now I want to use <?php JHTML::_('bootstrap.renderModal', 'modal-' . $name, $params); ?>.
In the html of the articles, we used:
<a id="modal_info" class="modal" href="images/stories/hotel_suite1.jpg"><img style="width: 30%;" src="images/stories/hotel_suite1.jpg" alt="Null" /></a>
with various values for width and src. What do I change in my html? And I assume I need to add placeholders for $name and $params in my index.php. How do those get filled in realtime?

Magento: how to display products on owl-carousel

I'm using magento 1.9.3 and I want to display featured products in home page in an owl carousel.
I have a method in the block of my module that returns me the collection I want to show in the carousel. I call it from my template like this:
$_productCollection=$this->getFeaturedProducts();
I found a previous question in stack overflow about this: Owl Carousel - Magento Products
and following this previous question I arrived to this in my template:
<div class="owl-carousel">
<?
$products = $this->getFeaturedProducts();
foreach ($products as $_product) { // iterate through the entire collection
echo '<div class="item"><img src='.$this->helper('catalog/image')->init($_product, 'small_image')->keepFrame(false)->resize($_imgSize).'></div>'; // print the image url inside of the required Owl markup
}
?>
</div>
But the div of owl-carousel is not displayed. If I inspect the page, the div is there, and the images inside too, but nothing is displayed. If I delete the owl-carousel class I see all the images displayed in list.
I installed the extension "Responsive Owl Slider" from magento connect, and I have another owl carousel on top of page made with the admin cms that shows image slides (not products) and it's working fine. The only one that fails is the one that I'm trying to do by code.
I see that the owl-carousel class has a display: none so obviously is not displaying anything, but if I delete the display: none it shows all the images at the same time, not a carousel.
How do I display my selected products in an owl carousel?
Please try this extension
https://www.magentocommerce.com/magento-connect/new-products-2.html
Hope it's helpful for you.
First go to the link >> https://magento.stackexchange.com/questions/83912/featured-products-on-homepage
Create all files to following answers.
Then open featured.phtml
copy and paste below code
<?php
$_helper = $this->helper('catalog/output');
$_productCollection = $this->getProductCollection();
?>
<div class="featured-products">
<ol class="featured-products-list owl-carousel" id="featured-products-list">
<?php foreach ($_productCollection as $_product): ?>
<li><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(200) ?>" alt="<?php echo $this->escapeHtml($_product->getName()) ?>" /></li>
<?php endforeach; ?>
</ol>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(".owl-carousel").owlCarousel();
});
</script>
Please don't forget create attribute and assign for products.

Carousel with dynamic content

I came across a carousel from Twitter bootstrap here. http://twitter.github.com/bootstrap/javascript.html#carousel
It looks really good. But all the images / content in the example are hard-coded. How can I request the server for new content and show it in the carousel?
The answer would have to be adjusted for each language, but assuming you're programing in PHP, it may look something like this:
If you have an array of images:
$images = ['path/to/image.jpg', 'path/to/image2.jpg', 'path/to/image3.jpg']
Then you'd loop through those images, and place each one in the appropriate HTML markup, like so:
<?php foreach ($images as $image) { ?>
<div class="item">
<img src="<?php echo $image ?>" />
</div>
<?php } ?>

Wordpress: show featured image with subcategory

I'm using this to generate a list of sub-pages that are a parent of 10 and images:
<ul>
<?php wp_list_pages('title_li=&child_of=10&link_after=<img src="http://mydomain.com/image.gif" alt="" />'); ?>
</ul>
It works, but the problem is I don't know how to get the post featured image there instead. I tried this but it did not work:
<?php wp_list_pages('title_li=&child_of=10&link_after=<img src="' . the_post_thumbnail(array(100,50)) . '" alt="" />'); ?>
Obviously I'm missing something.
Any suggestions would be appreciated.
To display the page titles along with the images, you should use get_pages()
<?php
$pages = get_pages('child_of=10');
if ($pages) {
echo '<ul>';
foreach ($pages as $page) {
echo '<li><a href="'.get_permalink($page->ID).'">';
echo get_the_title($page->ID);
echo get_the_post_thumbnail($page->ID);
echo '</a></li>';
}
echo '</ul>';
}
?>
The get_the_post_thumbnail function returns HTML not the image url.
Instead use
<?php $image_url = wp_get_attachment_image_src( get_post_thumbnail_id(10), array(100,50) ); ?>
<?php wp_list_pages('title_li=&child_of=10&link_after=<img src="' . $image_url . '" alt="" />'); ?>
This will list all sub-pages of page id 10, with thumbnail of page id 10. If you want the thumbnails of the sub-pages instead of parent page, you will have to write custom code instead of wp_list_pages function(as explained by Indranil).

Magento display multiple product images on details page

I am uploading 2 images for each product. Only 2 no more, no less.
1st image is product base image and will be displayed on product details page.
I am using following line to display this image:
$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize(180, 300).'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
echo $_helper->productAttribute($_product, $_img, 'image');
I am able to display the above image correctly.
Second image will be displayed in a pop up when a particular link is clicked. I do not want to display a gallery. Just want to display each image separately.
I think I found a way to retrieve array of images uploaded:
$productData = $_product->getData();
$secondImage = $productData['media_gallery']['images'][1];
Now, I am not sure how to display this image. I mean how to use helper, like I used for first image to make is display second image.
I've option to hardcode the complete path of image and use:
$secondImage['file'];
to display the image etc, but, I want to know if there is way, I can do it magento way ?
<?php foreach ($this->getGalleryImages() as $_image): ?>
<li>
<a href="#" onclick="popWin('<?php echo $this->getGalleryUrl($_image) ?>', 'gallery', 'scrollbars=yes,width=200,height=200,resizable=yes');return false;">
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(68,68); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
</a>
</li>
<?php endforeach; ?>
Code lifted from:
http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/catalog/adding_lightbox_to_magento_v2
Note exactly the answer but obviously you can remove the foreach and simply supply the array's index if you know your only going to have one file.

Resources