magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.55k stars 9.32k forks source link

Category image deletes after initial upload and category save v2.3.3 #25099

Closed davygxyz closed 5 years ago

davygxyz commented 5 years ago

Triage Note

Preconditions (*)

  1. Magento Version 2.3.3
  2. PHP version 7.2
  3. Apache 2.4
  4. Magento Default Theme

Steps to reproduce (*)

  1. Installed with composer: composer create-project --repository=https://repo.magento.com/ magento/project-community-edition
  2. Installed and logged into the admin
  3. Click on catalog > categories
  4. Upload category image
  5. Save category
  6. Save category again

Expected result (*)

  1. After the initial category image upload and save, if you save the category again without changing the image. The category should retain the original category image.

Screen Shot 2019-10-16 at 12 45 00 PM

Actual result (*)

  1. Instead, after my initial category image upload and save. The image disappears if I save the category.

Screen Shot 2019-10-16 at 12 50 35 PM

m2-assistant[bot] commented 5 years ago

Hi @davygxyz. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@davygxyz do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


m2-assistant[bot] commented 5 years ago

Hi @krishprakash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

davygxyz commented 5 years ago

@magento give me 2.3-develop instance

magento-engcom-team commented 5 years ago

Hi @davygxyz. Thank you for your request. I'm working on Magento 2.3-develop instance for you

magento-engcom-team commented 5 years ago

Hi @davygxyz, here is your Magento instance. Admin access: https://i-25099-2-3-develop.instances.magento-community.engineering/admin Login: admin Password: 123123q Instance will be terminated in up to 3 hours.

bliswebagency commented 5 years ago

We also have this problem after upgrading to 2.3.3. In our case the initial upload via ajax will suffix the file name with a _1, then on the subsequent saves, within the system it will try to match a filename with suffix _1_1 or a _2, _2_1 and so on, which seems to disassociate the file from the category. This only happens for the category section and not products.

Some relevant functions identified were getNewFileName (framework/File/Uploader.php) which suffixes a number to the filename, and checkUniqueImageName (module-catalog/Model/Category/Attribute/Backend/Image.php) which is triggered by the beforeSave event for categories. But it may be further up the callstack where the problem starts.

magento-engcom-team commented 5 years ago

:white_check_mark: Confirmed by @krishprakash Thank you for verifying the issue. Based on the provided information internal tickets MC-21893 were created

Issue Available: @krishprakash, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] commented 5 years ago

Hi @vivekkumar-webkul. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:


davygxyz commented 5 years ago

@bliswebagency Found a temp fix from your research: module-catalog/Model/Category/Attribute/Backend/Image.php

It looks like the problem was fixed with 2.3-develop but not 2.3.3 Comparing the code between the two and found these functions have been modified.

public function beforeSave($object) private function fileResidesOutsideCategoryDir($value)

You will probably need to create a temp custom module to overwrite these functions until the fix is out.

For testing purposes, I just replaced the core file to see if it works and it was successful. Now I have to do it the proper way and test it.

Just a heads up!

Link to dev file: https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php

bliswebagency commented 5 years ago

@davygxyz - Thank you for the heads up and the temp fix! We will give it a try and see how it goes with our install, but it definitely sounds like it will do the job. It's much appreciated.

adamonsoon commented 5 years ago

If you need to create a temp fix, here's how to use a full override (a plugin may be possible, but in both cases, you'd need to duplicate code due to most methods on \Magento\Catalog\Model\Category\Attribute\Backend\Image being private.

  1. In Namespace/Module/etc/adminhtml/di.xml add: <preference for="Magento\Catalog\Model\Category\Attribute\Backend\Image" type="Namespace\Module\Override\Category\Backend\Image"/>
  2. Copy https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php to Namespace/Module/Override/Category/Backend/Image.php
  3. Change the namespace to Namespace\Module\Override\Category\Backend
  4. Extend Magento\Catalog\Model\Category\Attribute\Backend\Image instead of \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend, otherwise, the image component will not be displayed in the admin
  5. In the beforeSave method change the return value from parent::beforeSave($object) to \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend::beforeSave($object) to avoid executing the buggy code.
  6. Optional: add a TODO comment referring to this issue at the top of the file
connect232 commented 5 years ago

I tried the above temp fix but the fileResidesOutsideCategoryDir($value) function returned true when the file resided in the category directory. This made it add /media/catalog/category to the image filename, which I didn't want.

I applied the following fix to solve the problem:-

In the beforeSave method in the file \Magento\Catalog\Model\Category\Attribute\Backend\Image replace

$imageName = $this->checkUniqueImageName($imageName);

with

if (array_key_exists('tmp_name', $value[0])) { $imageName = $this->checkUniqueImageName($imageName); }

This checks if a file has been uploaded when editing a category and if so, check if the filename exists in the category directory.

This avoids the renaming of the image file in the database if no file has been uploaded.

Hopefully this may help some of you who are having the same problem.

paul-blundell commented 5 years ago

Any indication on when this will be fixed by Magento?

Until then, with thanks to the above 2 comments, here is a small extension that fixes it.

magento-engcom-team commented 5 years ago

Hi @davygxyz, @vivekkumar-webkul.

Thank you for your report and collaboration!

The related internal Jira ticket MC-21893 was closed as non-reproducible in 2.3-develop. It means that Magento team either unable to reproduce this issue using provided Steps to Reproduce from the Description section on clean Magento instance or the issue has been already fixed in the scope of other tasks.

But if you still run into this problem please update or provide additional information/steps/preconditions in the Description section and reopen this issue.

andreyuok commented 5 years ago

PRECONDITION:

  1. Clean install Magento 2.3.3
  2. One Category Created.

STEPS TO REPRODUCE:

  1. Go to a category that was created in precondition 2 Open tab "Content" and upload "Category Image" (For example: name of file elephant.jpg)
  2. Save Category. (Category saved and opened again)
  3. Check "Content" tab that image you uploaded is displayed in Category Image attribute.
  4. Check "catalog_category_entity_varchar" table. Find name of your file "elephant.jpg" in a list of rows (by default in clean install category image attribute has id - 48)
  5. Do nothing and save the category again.
  6. Check "Content" tab again that image you uploaded earlier is still in Category Image attribute (Actual result is that picture has disappeared)
  7. Check "catalog_category_entity_varchar" table. Find name of your file uploaded earlier "elephant.jpg" in a list of rows. Note that name has changed from "elephant.jpg" to "elephant_1.jpg"

ACTUAL RESULT: The already uploaded category image Disappears when the category is saved again.

EXPECTED RESULT: The already uploaded category image should not disappear when the category saving again.

Checked on vanilla 2.3.3, today.

hostep commented 5 years ago

@madstrikeua: thanks for testing!

I also tested following your steps and can reproduce the problem in Magento 2.3.3, but no longer on the 2.3-develop branch. Which often means that the bug is already fixed and will most likely be included in Magento 2.3.4.

If I take a look at the commit messages for the Catalog module in between Magento 2.3.3 and the 2.3-develop branch, I find the following one, which might be the fix (untested, but the message looks promising): MC-19090: Category Image from Gallery is not saved

Feel free to test this fix and let us know if this fixes this problem or not.

Thanks again!

Update: it looks like @davygxyz also came to the same conclusion before.

chris-pook commented 5 years ago

For anyone arriving here wondering what to do whilst waiting for 2.3.4 to drop, I can confirm that the following patch (based on @davygxyz 's link to the 2.3-develop modifications), applied to 2.3.3 using Composer does indeed fix this issue by bringing in the upstream code added to fix it in 2.3.4:

--- Model/Category/FileInfo.original 2019-11-13 10:33:59.115099600 +0000
+++ Model/Category/FileInfo.php  2019-11-13 10:32:55.480579234 +0000
@@ -10,6 +10,8 @@
 use Magento\Framework\Filesystem;
 use Magento\Framework\Filesystem\Directory\WriteInterface;
 use Magento\Framework\Filesystem\Directory\ReadInterface;
+use Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Store\Model\StoreManagerInterface;

 /**
  * Class FileInfo
@@ -49,15 +51,25 @@
     private $pubDirectory;

     /**
+     * Store manager
+     *
+     * @var \Magento\Store\Model\StoreManagerInterface
+     */
+    private $storeManager;
+
+    /**
      * @param Filesystem $filesystem
      * @param Mime $mime
+     * @param StoreManagerInterface $storeManager
      */
     public function __construct(
         Filesystem $filesystem,
-        Mime $mime
+        Mime $mime,
+        StoreManagerInterface $storeManager
     ) {
         $this->filesystem = $filesystem;
         $this->mime = $mime;
+        $this->storeManager = $storeManager;
     }

     /**
@@ -152,7 +164,8 @@
      */
     private function getFilePath($fileName)
     {
-        $filePath = ltrim($fileName, '/');
+        $filePath = $this->removeStorePath($fileName);
+        $filePath = ltrim($filePath, '/');

         $mediaDirectoryRelativeSubpath = $this->getMediaDirectoryPathRelativeToBaseDirectoryPath($filePath);
         $isFileNameBeginsWithMediaDirectoryPath = $this->isBeginsWithMediaDirectoryPath($fileName);
@@ -177,7 +190,8 @@
      */
     public function isBeginsWithMediaDirectoryPath($fileName)
     {
-        $filePath = ltrim($fileName, '/');
+        $filePath = $this->removeStorePath($fileName);
+        $filePath = ltrim($filePath, '/');

         $mediaDirectoryRelativeSubpath = $this->getMediaDirectoryPathRelativeToBaseDirectoryPath($filePath);
         $isFileNameBeginsWithMediaDirectoryPath = strpos($filePath, (string) $mediaDirectoryRelativeSubpath) === 0;
@@ -186,6 +200,29 @@
     }

     /**
+     * Clean store path in case if it's exists
+     *
+     * @param string $path
+     * @return string
+     */
+    private function removeStorePath(string $path): string
+    {
+        $result = $path;
+        try {
+            $storeUrl = $this->storeManager->getStore()->getBaseUrl();
+        } catch (NoSuchEntityException $e) {
+            return $result;
+        }
+        // phpcs:ignore Magento2.Functions.DiscouragedFunction
+        $path = parse_url($path, PHP_URL_PATH);
+        // phpcs:ignore Magento2.Functions.DiscouragedFunction
+        $storePath = parse_url($storeUrl, PHP_URL_PATH);
+        $storePath = rtrim($storePath, '/');
+        $result = preg_replace('/^' . preg_quote($storePath, '/') . '/', '', $path);
+        return $result;
+    }
+
+    /**
      * Get media directory subpath relative to base directory path
      *
      * @param string $filePath

--- Model/Category/Attribute/Backend/Image.original  2019-11-13 10:34:02.032985517 +0000
+++ Model/Category/Attribute/Backend/Image.php   2019-11-13 10:33:09.291348190 +0000
@@ -121,11 +121,15 @@

         if ($this->fileResidesOutsideCategoryDir($value)) {
             // use relative path for image attribute so we know it's outside of category dir when we fetch it
+            // phpcs:ignore Magento2.Functions.DiscouragedFunction
+            $value[0]['url'] = parse_url($value[0]['url'], PHP_URL_PATH);
             $value[0]['name'] = $value[0]['url'];
         }

         if ($imageName = $this->getUploadedImageName($value)) {
-            $imageName = $this->checkUniqueImageName($imageName);
+            if (!$this->fileResidesOutsideCategoryDir($value)) {
+                $imageName = $this->checkUniqueImageName($imageName);
+            }
             $object->setData($this->additionalData . $attributeName, $value);
             $object->setData($attributeName, $imageName);
         } elseif (!is_string($value)) {
@@ -182,7 +186,7 @@
             return false;
         }

-        return strpos($fileUrl, $baseMediaDir) === 0;
+        return strpos($fileUrl, $baseMediaDir) !== false;
     }

     /**
Rickertje commented 5 years ago

Any suggestions for a temporary fix in 2.2.10?

Rickertje commented 5 years ago

For now I reinstalled the 2.2.9 versions of the below 2 files and this seems to do the (temporary) trick app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php app/code/Magento/Catalog/Model/ImageUploader.php

gregordonsky commented 5 years ago

I can confirm that the patch applied to Magento 2.3.3 using Composer fixed the issue. Unfortunately on my installation, after the image was uploaded, it is not copied from catalog/tmp/category to catalog/category. Does anyone else have this problem?

Preconditions (*)

  1. Magento 2.3.3

Steps to reproduce (*)

  1. Apply this patch
  2. Click on catalog > categories
  3. Click on the button "Upload" and upload a category image
  4. Save category

Expected result (*)

  1. Image should be uploaded in catalog/tmp/category
  2. Image should be moved to catalog/category

Actual result (*)

  1. Image is saved in catalog/tmp/category
  2. Image is not moved to catalog/category
  3. A line is written in exception.log

I applied the following fix to solve the problem:

In the beforeSave method in the file \Magento\Catalog\Model\Category\Attribute\Backend\Image add after:

if (!$this->fileResidesOutsideCategoryDir($value)) {
  $imageName = $this->checkUniqueImageName($imageName);
}

these lines:

if (array_key_exists('tmp_name', $value[0])) {
  $imageName = basename($imageName);
  $imageName = $this->checkUniqueImageName($imageName);
}

In the afterSave method in the file \Magento\Catalog\Model\Category\Attribute\Backend\Image replace: $this->getImageUploader()->moveFileFromTmp($imageName); with: $this->getImageUploader()->moveFileFromTmp(basename($imageName));

aliomattux commented 4 years ago

Could someone please explain the patch referenced? It says app/code/magento but the path for core code is vendor/magento.

Also, the patch says line 35 of Image.php but in core 2.3.3 that line of code is found on 122 in vendor/magento/module-catalog/Model/Category/Attribute/Backend/Image.php

Also, will Magento release an official patch for this issue that can be downloaded/applied from the downloads page? This seems like a pretty big issue.

I am able to apply the patch manually, just questioning the format in which it was provided.

gregordonsky commented 4 years ago

Hi @aliomattux

Could someone please explain the patch referenced? It says app/code/magento but the path for core code is vendor/magento.

If you are talking about the patch referenced in my comment, I was able to apply it automatically using the following guide:

https://devdocs.magento.com/guides/v2.3/comp-mgr/patching.html

So, for creating a custom patch, follow step 5:

5. Edit the file and remove app/code/<VENDOR>/<PACKAGE> from all paths so that they are relative to the vendor/<VENDOR>/<PACKAGE> directory.

This patch does not solve #25480 . You can try to apply manually the code changes reported in my previous comment to solve the issue #25480

I don't know if @paul-blundell's extension fixes #25480

aliomattux commented 4 years ago

The patch provided is not proper as it appends /media/catalog/category/ to the image url. I also don't understand in general why updating a product requires that the image field be written to at all.

erikhansen commented 4 years ago

I also ran into the issue that @gregordonsky commented about above, where images were getting uploaded to catalog/tmp/category instead of catalog/category. Adding his suggested changes to @chris-pook's patch fixed the issue for me. Here is an updated patch that includes the changes from @gregordonsky:

--- Model/Category/FileInfo.php 2019-11-13 10:33:59.115099600 +0000
+++ Model/Category/FileInfo.php  2019-11-13 10:32:55.480579234 +0000
@@ -10,6 +10,8 @@
 use Magento\Framework\Filesystem;
 use Magento\Framework\Filesystem\Directory\WriteInterface;
 use Magento\Framework\Filesystem\Directory\ReadInterface;
+use Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Store\Model\StoreManagerInterface;

 /**
  * Class FileInfo
@@ -49,15 +51,25 @@
     private $pubDirectory;

     /**
+     * Store manager
+     *
+     * @var \Magento\Store\Model\StoreManagerInterface
+     */
+    private $storeManager;
+
+    /**
      * @param Filesystem $filesystem
      * @param Mime $mime
+     * @param StoreManagerInterface $storeManager
      */
     public function __construct(
         Filesystem $filesystem,
-        Mime $mime
+        Mime $mime,
+        StoreManagerInterface $storeManager
     ) {
         $this->filesystem = $filesystem;
         $this->mime = $mime;
+        $this->storeManager = $storeManager;
     }

     /**
@@ -152,7 +164,8 @@
      */
     private function getFilePath($fileName)
     {
-        $filePath = ltrim($fileName, '/');
+        $filePath = $this->removeStorePath($fileName);
+        $filePath = ltrim($filePath, '/');

         $mediaDirectoryRelativeSubpath = $this->getMediaDirectoryPathRelativeToBaseDirectoryPath($filePath);
         $isFileNameBeginsWithMediaDirectoryPath = $this->isBeginsWithMediaDirectoryPath($fileName);
@@ -177,7 +190,8 @@
      */
     public function isBeginsWithMediaDirectoryPath($fileName)
     {
-        $filePath = ltrim($fileName, '/');
+        $filePath = $this->removeStorePath($fileName);
+        $filePath = ltrim($filePath, '/');

         $mediaDirectoryRelativeSubpath = $this->getMediaDirectoryPathRelativeToBaseDirectoryPath($filePath);
         $isFileNameBeginsWithMediaDirectoryPath = strpos($filePath, (string) $mediaDirectoryRelativeSubpath) === 0;
@@ -186,6 +200,29 @@
     }

     /**
+     * Clean store path in case if it's exists
+     *
+     * @param string $path
+     * @return string
+     */
+    private function removeStorePath(string $path): string
+    {
+        $result = $path;
+        try {
+            $storeUrl = $this->storeManager->getStore()->getBaseUrl();
+        } catch (NoSuchEntityException $e) {
+            return $result;
+        }
+        // phpcs:ignore Magento2.Functions.DiscouragedFunction
+        $path = parse_url($path, PHP_URL_PATH);
+        // phpcs:ignore Magento2.Functions.DiscouragedFunction
+        $storePath = parse_url($storeUrl, PHP_URL_PATH);
+        $storePath = rtrim($storePath, '/');
+        $result = preg_replace('/^' . preg_quote($storePath, '/') . '/', '', $path);
+        return $result;
+    }
+
+    /**
      * Get media directory subpath relative to base directory path
      *
      * @param string $filePath

--- Model/Category/Attribute/Backend/Image.php  2019-11-13 10:34:02.032985517 +0000
+++ Model/Category/Attribute/Backend/Image.php   2019-11-13 10:33:09.291348190 +0000
@@ -121,11 +121,20 @@

         if ($this->fileResidesOutsideCategoryDir($value)) {
             // use relative path for image attribute so we know it's outside of category dir when we fetch it
+            // phpcs:ignore Magento2.Functions.DiscouragedFunction
+            $value[0]['url'] = parse_url($value[0]['url'], PHP_URL_PATH);
             $value[0]['name'] = $value[0]['url'];
         }

         if ($imageName = $this->getUploadedImageName($value)) {
-            $imageName = $this->checkUniqueImageName($imageName);
+            if (!$this->fileResidesOutsideCategoryDir($value)) {
+                $imageName = $this->checkUniqueImageName($imageName);
+            }
+            // Change from https://github.com/magento/magento2/issues/25099#issuecomment-554432290
+            if (array_key_exists('tmp_name', $value[0])) {
+                $imageName = basename($imageName);
+                $imageName = $this->checkUniqueImageName($imageName);
+            }
             $object->setData($this->additionalData . $attributeName, $value);
             $object->setData($attributeName, $imageName);
         } elseif (!is_string($value)) {
@@ -182,7 +191,7 @@
             return false;
         }

-        return strpos($fileUrl, $baseMediaDir) === 0;
+        return strpos($fileUrl, $baseMediaDir) !== false;
     }

     /**
@@ -197,7 +206,8 @@

         if ($this->isTmpFileAvailable($value) && $imageName = $this->getUploadedImageName($value)) {
             try {
-                $this->getImageUploader()->moveFileFromTmp($imageName);
+                // Change from https://github.com/magento/magento2/issues/25099#issuecomment-554432290
+                $this->getImageUploader()->moveFileFromTmp(basename($imageName));
             } catch (\Exception $e) {
                 $this->_logger->critical($e);
             }
erikhansen commented 4 years ago

After looking at this a bit more, I'm also seeing what @aliomattux mentioned above, where /media/catalog/category/ is getting prepended to the image path. So while the patch does seem to fix the issue (and the image shows on the frontend), proceed with caution.

rinamatrix commented 4 years ago

Hi , Please any one give the patch link , to overcome this category image issue .

aliomattux commented 4 years ago

You should wait for the next version of Magento to come out so you can download it and get the fix while at the same time introducing other bugs that wont be fixed until the next release. ;)

On Thu, Jan 16, 2020 at 4:47 AM rinamatrix notifications@github.com wrote:

Hi , Please any one give the patch , to overcome this issue category image issue .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/magento/magento2/issues/25099?email_source=notifications&email_token=AAIAVCOGG6UJE4XRZGS3CJTQ6A3LFA5CNFSM4JBOGHJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJDT2SI#issuecomment-575094089, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIAVCMATB5RGUBM4XZ7YELQ6A3LFANCNFSM4JBOGHJA .

hostep commented 4 years ago

I'm going to link https://github.com/magento/magento2/issues/25480 in here as that might be relevant as well in context of this bug. I've linked to a commit in there which might need to be applied together with the solutions mentioned above.

I haven't tested these things myself though, due to lack of time, so no promises that this will work.

davidpixie commented 4 years ago

This is still happening on fresh install of 2.3.4. Reverting the following file to the 2.3.2 version fixed it for me:

module-catalog/Model/Category/Attribute/Backend/Image.php

michel334 commented 4 years ago

Magento, how bout some good old fashioned quality control?

alex-james commented 4 years ago

I have the same issue with 2.3.3 to me it looks like the issue is in Magento\Catalog\Model\Category\Attribute\Backend::beforeSave() where it makes a call to checkUniqueImageName() which it never did before and which will always return a unique filename. so why not check if the $imageName value matches the attribute value for the "Image" attribute already stored against the $object and if they are the same, don't call checkUniqueImageName()?

alex-james commented 4 years ago

Seems to have fixed it: https://github.com/cogensoft-uk/magento-category-image-fix

kennedyabitbol commented 4 years ago

This is still happening on fresh install of 2.3.4. Reverting the following file to the 2.3.2 version fixed it for me:

module-catalog/Model/Category/Attribute/Backend/Image.php

Also worked for me with 2.3.4

nayan88 commented 4 years ago

Updated this Image.php file in 2.3.4 version and its working fine, now I upgraded to 2.3.5 then again issue reproduce, not the image is stored in tmp directory but not moved to actual media/catalog/category directory.

is anyone face this issue on 2.3.5 version ?

davygxyz commented 4 years ago

@nayan88 This issue sucks and they broke it once more in 2.3.5. I did however use what @alex-james posted and it seems to work okay.

https://github.com/magento/magento2/issues/25099#issuecomment-593993886

aliomattux commented 4 years ago

Don't want to deviate from the issue, but I learned quickly not to update Magento as soon as a new version is released despite them advising you to do so for these types of issues. When you do update, be sure to check everything thoroughly. There has been several times in the past when Magento has released a version that caused additional issues.

On Thu, May 28, 2020 at 3:45 PM davygxyz notifications@github.com wrote:

@nayan88 https://github.com/nayan88 This issue sucks and they broke it once more. I did however use what @alex-james https://github.com/alex-james posted and it seems to work okay.

25099 (comment)

https://github.com/magento/magento2/issues/25099#issuecomment-593993886

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/magento/magento2/issues/25099#issuecomment-635598071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIAVCPC5ESB2G4HYSMAM5LRT3EPPANCNFSM4JBOGHJA .

andy17612 commented 4 years ago

@alex-james may i ask in vendor which path please?

alex-james commented 4 years ago

@alex-james may i ask in vendor which path please?

Sorry @andy17612 Not sure I understand the question , if you are referring to the fix I posted you can keep the Vendor name the same or use your own, up to you.

andy17612 commented 4 years ago

@alex-james Do you know how to fix it like: https://magento.stackexchange.com/questions/309329/magento-2-category-image-url-showing-two-paths & https://github.com/magento/magento2/issues/11995 thank you

carlos-reynosa commented 4 years ago

I was having an issue with 2.3.3-p1 where i created an additional category image but when i would upload the new category image it would delete any other category image. @alex-james 's fix removed the issue.

JonathanHelvey commented 4 years ago

I am on Magento 2.3.5. This is happening to me. Is there any Fix to this from Magento?

jakwinkler commented 4 years ago

Why this issue was closed?!

Cookster4444 commented 3 years ago

Exactly agree with the last statement. I have run into this issue with a fresh 2.3.4 install and need a fix. One should come from magento yes????

Anyway what would be the best fix changing the Image.php???? So I can move on

alex-james commented 3 years ago

@Cookster4444 You are welcome to try my fix: https://github.com/cogensoft-uk/magento-category-image-fix

Cookster4444 commented 3 years ago

Thanks Alex,

Is it just a case of changing the Image.php file and running php bin/magento setup:static-content:deploy -f Where does the etc file go??

alex-james commented 3 years ago

No you shouldn't be changing the core files, the link I posted is for a module that will add a workaround which leaves the core files intact but fixes the issue. Copy the Cogensoft folder under app/code and run setup:upgrade then you are good to go

Cookster4444 commented 3 years ago

Cheers will do

Cookster4444 commented 3 years ago

Hi Alex,

Do you have a composer link as that doesn't seem to work putting in app/code

Cheers

Michael

On Sat, Nov 21, 2020 at 3:12 PM Alex Lancaster notifications@github.com wrote:

No you shouldn't be changing the core files, the link I posted is for a module that will add a workaround which leaves the core files intact but fixes the issue. Copy the Cogensoft folder under app/code and run setup:upgrade then you are good to go

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/magento/magento2/issues/25099#issuecomment-731592061, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIENMUAJYV67U3GS23PECI3SQ7KFJANCNFSM4JBOGHJA .

alex-james commented 3 years ago

Apologies @Cookster4444 the github was missing the registration and module files, try now

timh5690 commented 3 years ago

Hi Alex,

I am having this issue with Magneto 2.3.6. The category images I am uploading are not showing up after updating to this version of Magento. I have tried installing the Cogensoft folder under app/code, run setup:upgrade, setup:compile, and redeployed static content. But I am still having the same issues. Do you have any other recommendations for me? I would really appreciate the help.

Thank you, Tim