Display category image in product view gallerygetMediaGallery() how to see which image is thumbnail, small_image, image?Storeviews not showing the same product image after importHow to get the image type in media image collection?CloudZoom Magento integrationMagento 1.x set thumbnail image same as small image for all productsRemove zoom from product image on product details pagehow to exclude some image from product gallery on front endConfigurable Product image swapping with swatch image?Magento 2.2 adding images to product programmatically does not set small_imageReplace Bitmap Product Image with Jpg?
Would a 7805 5 V regulator drain a 9 V battery?
Counterfeit checks were created for my account. How does this type of fraud work?
"Correct me if I'm wrong"
Is there any possible way to get these hearts as Adult Link?
What is the most suitable position for a bishop here?
Why one uses 了 and the other one doesn’t?
Why there is a red color in right side?
Why is it 出差去 and not 去出差?
Justifying Affordable Bespoke Spaceships
How can I ping multiple IP addresses at the same time?
What is the maximum that Player 1 can win?
Are there any individual aliens that have gained superpowers in the Marvel universe?
Examples of protocols that are insecure when run concurrently
reverse a call to mmap()
How to sort human readable size
Bent arrow under a node
The Amazing Sliding Crossword
Kelvin type connection
Are intrusions within a foreign embassy considered an act of war?
Is there a polite way to ask about one's ethnicity?
How can I improve my violin intonation for enharmonic notes?
Scaling an object to change its key
Am I legally required to provide a (GPL licensed) source code even after a project is abandoned?
How did Frodo know where the Bree village was?
Display category image in product view gallery
getMediaGallery() how to see which image is thumbnail, small_image, image?Storeviews not showing the same product image after importHow to get the image type in media image collection?CloudZoom Magento integrationMagento 1.x set thumbnail image same as small image for all productsRemove zoom from product image on product details pagehow to exclude some image from product gallery on front endConfigurable Product image swapping with swatch image?Magento 2.2 adding images to product programmatically does not set small_imageReplace Bitmap Product Image with Jpg?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to display the category image as product image.
So I put this code to my Observer:
$product = $this->_registry->registry('current_product');
$product->addImageToMediaGallery('catalog/category/test.png', array('image', 'small_image', 'thumbnail'), false, false);
This doesn't work. But when I save the product:
$product->save();
He saves the images to the product permanently.
But I want to add the image only for this one request.
I tried also to manipulate the Gallery.php and XML, but then the zoom function isn't working anymore.
How can I achieve this?
Thank you
magento2.3 product-images
add a comment |
I want to display the category image as product image.
So I put this code to my Observer:
$product = $this->_registry->registry('current_product');
$product->addImageToMediaGallery('catalog/category/test.png', array('image', 'small_image', 'thumbnail'), false, false);
This doesn't work. But when I save the product:
$product->save();
He saves the images to the product permanently.
But I want to add the image only for this one request.
I tried also to manipulate the Gallery.php and XML, but then the zoom function isn't working anymore.
How can I achieve this?
Thank you
magento2.3 product-images
Why you need to save category image to product. You want to show at gallery section at frontend?
– Amit Bera♦
Jun 11 at 3:48
if you want to add images only for one product pass the sku and load the product and then do your work
– mohith
Jun 11 at 4:49
@Amit It should not save the image, but I dont know another way to add the image.
– Lars
Jun 11 at 7:08
@mohith what do you mean with „do your work“. I have the product already loaded, but dont know how to add the image without save it permanently.
– Lars
Jun 11 at 7:09
add a comment |
I want to display the category image as product image.
So I put this code to my Observer:
$product = $this->_registry->registry('current_product');
$product->addImageToMediaGallery('catalog/category/test.png', array('image', 'small_image', 'thumbnail'), false, false);
This doesn't work. But when I save the product:
$product->save();
He saves the images to the product permanently.
But I want to add the image only for this one request.
I tried also to manipulate the Gallery.php and XML, but then the zoom function isn't working anymore.
How can I achieve this?
Thank you
magento2.3 product-images
I want to display the category image as product image.
So I put this code to my Observer:
$product = $this->_registry->registry('current_product');
$product->addImageToMediaGallery('catalog/category/test.png', array('image', 'small_image', 'thumbnail'), false, false);
This doesn't work. But when I save the product:
$product->save();
He saves the images to the product permanently.
But I want to add the image only for this one request.
I tried also to manipulate the Gallery.php and XML, but then the zoom function isn't working anymore.
How can I achieve this?
Thank you
magento2.3 product-images
magento2.3 product-images
asked Jun 10 at 21:32
LarsLars
1007
1007
Why you need to save category image to product. You want to show at gallery section at frontend?
– Amit Bera♦
Jun 11 at 3:48
if you want to add images only for one product pass the sku and load the product and then do your work
– mohith
Jun 11 at 4:49
@Amit It should not save the image, but I dont know another way to add the image.
– Lars
Jun 11 at 7:08
@mohith what do you mean with „do your work“. I have the product already loaded, but dont know how to add the image without save it permanently.
– Lars
Jun 11 at 7:09
add a comment |
Why you need to save category image to product. You want to show at gallery section at frontend?
– Amit Bera♦
Jun 11 at 3:48
if you want to add images only for one product pass the sku and load the product and then do your work
– mohith
Jun 11 at 4:49
@Amit It should not save the image, but I dont know another way to add the image.
– Lars
Jun 11 at 7:08
@mohith what do you mean with „do your work“. I have the product already loaded, but dont know how to add the image without save it permanently.
– Lars
Jun 11 at 7:09
Why you need to save category image to product. You want to show at gallery section at frontend?
– Amit Bera♦
Jun 11 at 3:48
Why you need to save category image to product. You want to show at gallery section at frontend?
– Amit Bera♦
Jun 11 at 3:48
if you want to add images only for one product pass the sku and load the product and then do your work
– mohith
Jun 11 at 4:49
if you want to add images only for one product pass the sku and load the product and then do your work
– mohith
Jun 11 at 4:49
@Amit It should not save the image, but I dont know another way to add the image.
– Lars
Jun 11 at 7:08
@Amit It should not save the image, but I dont know another way to add the image.
– Lars
Jun 11 at 7:08
@mohith what do you mean with „do your work“. I have the product already loaded, but dont know how to add the image without save it permanently.
– Lars
Jun 11 at 7:09
@mohith what do you mean with „do your work“. I have the product already loaded, but dont know how to add the image without save it permanently.
– Lars
Jun 11 at 7:09
add a comment |
0
active
oldest
votes
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%2f277878%2fdisplay-category-image-in-product-view-gallery%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f277878%2fdisplay-category-image-in-product-view-gallery%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
Why you need to save category image to product. You want to show at gallery section at frontend?
– Amit Bera♦
Jun 11 at 3:48
if you want to add images only for one product pass the sku and load the product and then do your work
– mohith
Jun 11 at 4:49
@Amit It should not save the image, but I dont know another way to add the image.
– Lars
Jun 11 at 7:08
@mohith what do you mean with „do your work“. I have the product already loaded, but dont know how to add the image without save it permanently.
– Lars
Jun 11 at 7:09