Magento 2 : How to get product get images for thumbnail?Base Image, Small Image, Thumbnail Image radio buttons are not selected after product images CSV importHow to get product image by label in cartMagento 2 Rest Api get Thumbnail Image urlhow to get all images of a particular productHow to get “ALL” associated products images?magento 2.2.2 - How to transfer the product thumbnail to the left sideHow to display Multiple thumbnail imagesmagento website loads 2 images for a same productHow can I change more images thumbnail image placement on product page?How to increase/decrease space in thumbnail images on Product Page (catalog-product-view) Magento

Help find my computational error for logarithms

Did Amazon pay $0 in taxes last year?

From an axiomatic set theoric approach why can we take uncountable unions?

Why does cron require MTA for logging?

Conservation of Mass and Energy

What do *foreign films* mean for an American?

How exactly does an Ethernet collision happen in the cable, since nodes use different circuits for Tx and Rx?

Has a sovereign Communist government ever run, and conceded loss, on a fair election?

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

Would an aboleth's Phantasmal Force lair action be affected by Counterspell, Dispel Magic, and/or Slow?

Recommendation letter by significant other if you worked with them professionally?

Can I negotiate a patent idea for a raise, under French law?

What ability score modifier does a javelin's damage use?

Power Strip for Europe

Does an unused member variable take up memory?

How to check whether module is loaded with custom configurations?

Giving a career talk in my old university, how prominently should I tell students my salary?

Does "Until when" sound natural for native speakers?

How does Ehrenfest's theorem apply to the quantum harmonic oscillator?

Specifying a starting column with colortbl package and xcolor

Why couldn't the separatists legally leave the Republic?

In the late 1940’s to early 1950’s what technology was available that could melt a LOT of ice?

What is better: yes / no radio, or simple checkbox?

What is Earthy controling in the ISS cupola?



Magento 2 : How to get product get images for thumbnail?


Base Image, Small Image, Thumbnail Image radio buttons are not selected after product images CSV importHow to get product image by label in cartMagento 2 Rest Api get Thumbnail Image urlhow to get all images of a particular productHow to get “ALL” associated products images?magento 2.2.2 - How to transfer the product thumbnail to the left sideHow to display Multiple thumbnail imagesmagento website loads 2 images for a same productHow can I change more images thumbnail image placement on product page?How to increase/decrease space in thumbnail images on Product Page (catalog-product-view) Magento













1















enter image description here



Friend please help me how to get product images and thumbnail images.










share|improve this question
























  • 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
















1















enter image description here



Friend please help me how to get product images and thumbnail images.










share|improve this question
























  • 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














1












1








1








enter image description here



Friend please help me how to get product images and thumbnail images.










share|improve this question
















enter image description here



Friend please help me how to get product images and thumbnail images.







magento2 product-images thumbail






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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


















  • 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











1 Answer
1






active

oldest

votes


















1














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 !!






share|improve this answer






















    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
    );



    );













    draft saved

    draft discarded


















    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









    1














    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 !!






    share|improve this answer



























      1














      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 !!






      share|improve this answer

























        1












        1








        1







        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 !!






        share|improve this answer













        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 !!







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 16 '18 at 19:36









        Rohan HapaniRohan Hapani

        6,45331764




        6,45331764



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Nidaros erkebispedøme

            Birsay

            Was Woodrow Wilson really a Liberal?Was World War I a war of liberals against authoritarians?Founding Fathers...