How to output the thumbnail of the featured image Wordpress? - image

I want to output the thumbnail of the featured image of a post inside one of my widgets? How can I do that inside the loop, in Wordpress. I'm using version 3.3.1

you can use
<?php the_post_thumbnail(); ?>
or if you want only the image src and not all the wordpress's html output, use this:
<?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
references:
http://codex.wordpress.org/Function_Reference/the_post_thumbnail
http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

Related

Image file was not found for custom attribute

I am using magento 1.9.1
I have added media attribute name 'offer_image' in images.
I have also set in attribute set and added image to this attribute in product page.
When I try to get this attribute image on frontent it show error
"Image file was not found"
I am using this code to get image
$this->helper('catalog/image')->init($_product, 'offer_image')->resize(50);
This code work fine if I use thumbnail or small_image.
How should I get custom attribute image, what is wrong with code.
Try to load a product first (looks like you're taking it from a collection):
$product = Mage::getModel('catalog/product')->load($_product->getId());
$this->helper('catalog/image')->init($product, 'offer_image')->resize(50);
<?php if ($_product->getOfferImage() && ($_product->getOfferImage() != 'no_selection')):?>
<img src="<?php echo $_product->getOfferImage();?>">
<?php endif;?>

change product images path in magento site

In Product view page, image is serving from this path : link
/media/catalog/product/cache/1/image/350x350/9df78eab33525d08d6e5fb8d27136e95/b/a/ball.jpg
it's using 350x350 size
but i wanted to serve from this path : link2
media/catalog/product/cache/1/image/850x850/9df78eab33525d08d6e5fb8d27136e95/b/a/ball.jpg
I need 850x850 size.
we are using : <?php echo $dexxtz->getImageFeatured($this->helper('catalog/image')->init($_product, 'image')); ?>
You need to tell Magento about the resolution for which you want to pick the image, resize will help you in your case:-
$this->helper('catalog/image')->init($_product, 'image')->resize(850, 850);

Embedding Slideshow , broken images

i need help in this situation , i am embedding a slideshow using wowslider ... its included through the index.php file
<div class="content">
<?php
include 'includes/aside.php';
include 'includes/widgets/slideshow.html';
?>
</div>
Link of the broken images
Direct link for the slideshow , works properly
(Note : this is just a test slideshow not the final one . )
try it
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
include "$root/includes/aside.php";
include "$root/includes/widgets/slideshow.html";
***change the links in slider to absolute links.

Magento Commerce - Use new image type on front page

I added a new image type to the image uploads called featured_banner_image. If a product is marked as featured I have a jQuery slider that will pull the featured_banner_image on the front page.
The problem is that
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'featured_banner_image')->resize(135) ?>">
does not work. What code can I pull to grab my new image?

echoing a image in view page from DB

i'm using Ci and i have a form that saves image in a folder. The name of the image is saved in my DB. I want to echo this image.i can retrieve the image name from Db but when i'm echoing this the image it is not showing. I think my controller and model is working fine but there is something wrong with my view.
the part where i'm echoing the image:
<img src="<?php echo base_url();?>uploads/$info[0]->image"></img>
info is the array where the information from the DB(like image name) is saved.
I cannot find my mistake.please help.
I think it's because you're using $info[0]->image outside the PHP tags.
It should be like this:
<img src="<?php echo base_url().'uploads/'.$info[0]->image; ?>" />
One more mistake is how you write the HTML tag IMG

Resources