Magento 2 : How to get product get images for thumbnail?How to programmatically get thumbnail of a...
Can I use a violin G string for D?
Giving a career talk in my old university, how prominently should I tell students my salary?
For which categories of spectra is there an explicit description of the fibrant objects via lifting properties?
How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?
Did Amazon pay $0 in taxes last year?
Confusion about Complex Continued Fraction
When a wind turbine does not produce enough electricity how does the power company compensate for the loss?
How can I manipulate the output of Information?
How do we create new idioms and use them in a novel?
How can I get players to focus on the story aspect of D&D?
Are all players supposed to be able to see each others' character sheets?
What is this diamond of every day?
From an axiomatic set theoric approach why can we take uncountable unions?
Street obstacles in New Zealand
Signed and unsigned numbers
Haman going to the second feast dirty
School performs periodic password audits. Is my password compromised?
Why is a very small peak with larger m/z not considered to be the molecular ion?
Which situations would cause a company to ground or recall a aircraft series?
Outlet with 3 sets of wires
Why is there an extra space when I type "ls" in the Desktop directory?
Is divide-by-zero a security vulnerability?
Can't make sense of a paragraph from Lovecraft
How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?
Magento 2 : How to get product get images for thumbnail?
How to programmatically get thumbnail of a product?Magento 2 Rest Api get Thumbnail Image urlRemove white background from thumbnail images in Magento 2.1.3magento 2 get child product image thumbnailmagento 2.2.2 - How to transfer the product thumbnail to the left sideHow to display Multiple thumbnail imagesThumbnail role missing in product edit page adminDetail page - Display configurable product's thumbnail images even when an option is selected!Product Category Thumbnail Image Not WorkingHow to increase/decrease space in thumbnail images on Product Page (catalog-product-view) Magento
Friend please help me how to get product images and thumbnail images.
magento2 product-images thumbail
|
show 3 more comments
Friend please help me how to get product images and thumbnail images.
magento2 product-images thumbail
you need to get Thumbnail product URL from Product collection?
– Abhishek Panchal
Jul 16 '18 at 19:19
so sir complete code given i have new developer so very problem understating. in magento code so please given on this code
– pushpendra
Jul 16 '18 at 19:23
I can not understand your question. Can you please specify where you want to show that thumbnail image?
– Abhishek Panchal
Jul 16 '18 at 19:25
wait i can explain
– pushpendra
Jul 16 '18 at 19:25
Yes. please explain in details.
– Rohan Hapani
Jul 16 '18 at 19:27
|
show 3 more comments
Friend please help me how to get product images and thumbnail images.
magento2 product-images thumbail
Friend please help me how to get product images and thumbnail images.
magento2 product-images thumbail
magento2 product-images thumbail
edited 15 mins ago
Piyush
4,82972054
4,82972054
asked Jul 16 '18 at 19:17
pushpendrapushpendra
114
114
you need to get Thumbnail product URL from Product collection?
– Abhishek Panchal
Jul 16 '18 at 19:19
so sir complete code given i have new developer so very problem understating. in magento code so please given on this code
– pushpendra
Jul 16 '18 at 19:23
I can not understand your question. Can you please specify where you want to show that thumbnail image?
– Abhishek Panchal
Jul 16 '18 at 19:25
wait i can explain
– pushpendra
Jul 16 '18 at 19:25
Yes. please explain in details.
– Rohan Hapani
Jul 16 '18 at 19:27
|
show 3 more comments
you need to get Thumbnail product URL from Product collection?
– Abhishek Panchal
Jul 16 '18 at 19:19
so sir complete code given i have new developer so very problem understating. in magento code so please given on this code
– pushpendra
Jul 16 '18 at 19:23
I can not understand your question. Can you please specify where you want to show that thumbnail image?
– Abhishek Panchal
Jul 16 '18 at 19:25
wait i can explain
– pushpendra
Jul 16 '18 at 19:25
Yes. please explain in details.
– Rohan Hapani
Jul 16 '18 at 19:27
you need to get Thumbnail product URL from Product collection?
– Abhishek Panchal
Jul 16 '18 at 19:19
you need to get Thumbnail product URL from Product collection?
– Abhishek Panchal
Jul 16 '18 at 19:19
so sir complete code given i have new developer so very problem understating. in magento code so please given on this code
– pushpendra
Jul 16 '18 at 19:23
so sir complete code given i have new developer so very problem understating. in magento code so please given on this code
– pushpendra
Jul 16 '18 at 19:23
I can not understand your question. Can you please specify where you want to show that thumbnail image?
– Abhishek Panchal
Jul 16 '18 at 19:25
I can not understand your question. Can you please specify where you want to show that thumbnail image?
– Abhishek Panchal
Jul 16 '18 at 19:25
wait i can explain
– pushpendra
Jul 16 '18 at 19:25
wait i can explain
– pushpendra
Jul 16 '18 at 19:25
Yes. please explain in details.
– Rohan Hapani
Jul 16 '18 at 19:27
Yes. please explain in details.
– Rohan Hapani
Jul 16 '18 at 19:27
|
show 3 more comments
1 Answer
1
active
oldest
votes
You need to inject the ImageBuilder class in our block :
protected $_imageBuilder;
public function __construct(
........
MagentoCatalogBlockProductImageBuilder $_imageBuilder
........
){
........
$this->_imageBuilder=$_imageBuilder;
........
}
public function getImage($product, $imageId, $attributes = [])
{
return $this->_imageBuilder->setProduct($product)
->setImageId($imageId)
->setAttributes($attributes)
->create();
}
=> This is default image type :
$imageType = 'product_base_image'; //For getting the base image
$imageType = 'product_small_image'; //For getting the small image
$imageType = 'product_thumbnail_image'; //For getting the thumbnail image
Now, get thumbnail image in phtml file :
<?php
$imageType = 'product_thumbnail_image'; //for thumbnail image
$image = $block->getImage($_item, $imageType);
?>
<img src = "<?php echo $image->getImageUrl(); ?>" />
Hope, It may be helpful for you !!
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f234740%2fmagento-2-how-to-get-product-get-images-for-thumbnail%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to inject the ImageBuilder class in our block :
protected $_imageBuilder;
public function __construct(
........
MagentoCatalogBlockProductImageBuilder $_imageBuilder
........
){
........
$this->_imageBuilder=$_imageBuilder;
........
}
public function getImage($product, $imageId, $attributes = [])
{
return $this->_imageBuilder->setProduct($product)
->setImageId($imageId)
->setAttributes($attributes)
->create();
}
=> This is default image type :
$imageType = 'product_base_image'; //For getting the base image
$imageType = 'product_small_image'; //For getting the small image
$imageType = 'product_thumbnail_image'; //For getting the thumbnail image
Now, get thumbnail image in phtml file :
<?php
$imageType = 'product_thumbnail_image'; //for thumbnail image
$image = $block->getImage($_item, $imageType);
?>
<img src = "<?php echo $image->getImageUrl(); ?>" />
Hope, It may be helpful for you !!
add a comment |
You need to inject the ImageBuilder class in our block :
protected $_imageBuilder;
public function __construct(
........
MagentoCatalogBlockProductImageBuilder $_imageBuilder
........
){
........
$this->_imageBuilder=$_imageBuilder;
........
}
public function getImage($product, $imageId, $attributes = [])
{
return $this->_imageBuilder->setProduct($product)
->setImageId($imageId)
->setAttributes($attributes)
->create();
}
=> This is default image type :
$imageType = 'product_base_image'; //For getting the base image
$imageType = 'product_small_image'; //For getting the small image
$imageType = 'product_thumbnail_image'; //For getting the thumbnail image
Now, get thumbnail image in phtml file :
<?php
$imageType = 'product_thumbnail_image'; //for thumbnail image
$image = $block->getImage($_item, $imageType);
?>
<img src = "<?php echo $image->getImageUrl(); ?>" />
Hope, It may be helpful for you !!
add a comment |
You need to inject the ImageBuilder class in our block :
protected $_imageBuilder;
public function __construct(
........
MagentoCatalogBlockProductImageBuilder $_imageBuilder
........
){
........
$this->_imageBuilder=$_imageBuilder;
........
}
public function getImage($product, $imageId, $attributes = [])
{
return $this->_imageBuilder->setProduct($product)
->setImageId($imageId)
->setAttributes($attributes)
->create();
}
=> This is default image type :
$imageType = 'product_base_image'; //For getting the base image
$imageType = 'product_small_image'; //For getting the small image
$imageType = 'product_thumbnail_image'; //For getting the thumbnail image
Now, get thumbnail image in phtml file :
<?php
$imageType = 'product_thumbnail_image'; //for thumbnail image
$image = $block->getImage($_item, $imageType);
?>
<img src = "<?php echo $image->getImageUrl(); ?>" />
Hope, It may be helpful for you !!
You need to inject the ImageBuilder class in our block :
protected $_imageBuilder;
public function __construct(
........
MagentoCatalogBlockProductImageBuilder $_imageBuilder
........
){
........
$this->_imageBuilder=$_imageBuilder;
........
}
public function getImage($product, $imageId, $attributes = [])
{
return $this->_imageBuilder->setProduct($product)
->setImageId($imageId)
->setAttributes($attributes)
->create();
}
=> This is default image type :
$imageType = 'product_base_image'; //For getting the base image
$imageType = 'product_small_image'; //For getting the small image
$imageType = 'product_thumbnail_image'; //For getting the thumbnail image
Now, get thumbnail image in phtml file :
<?php
$imageType = 'product_thumbnail_image'; //for thumbnail image
$image = $block->getImage($_item, $imageType);
?>
<img src = "<?php echo $image->getImageUrl(); ?>" />
Hope, It may be helpful for you !!
answered Jul 16 '18 at 19:36
Rohan HapaniRohan Hapani
6,45331764
6,45331764
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f234740%2fmagento-2-how-to-get-product-get-images-for-thumbnail%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
you need to get Thumbnail product URL from Product collection?
– Abhishek Panchal
Jul 16 '18 at 19:19
so sir complete code given i have new developer so very problem understating. in magento code so please given on this code
– pushpendra
Jul 16 '18 at 19:23
I can not understand your question. Can you please specify where you want to show that thumbnail image?
– Abhishek Panchal
Jul 16 '18 at 19:25
wait i can explain
– pushpendra
Jul 16 '18 at 19:25
Yes. please explain in details.
– Rohan Hapani
Jul 16 '18 at 19:27