carbon-fields icon indicating copy to clipboard operation
carbon-fields copied to clipboard

Missing preview image

Open dhalucario opened this issue 4 years ago • 9 comments

Version

  • Carbon Fields: v3.3.2
  • WordPress: 5.8
  • PHP: 7.4

Expected Behavior

The preview images should be loaded after migrating to a different domain. Preview images should be able to be found without having the domain in the url or by loading the media based on the ID.

Actual Behavior

The preview images aren't loaded.

Container definition

Container::make('post_meta', __('Product Set Tab'))
    ->where('post_type' , '=', 'krct_pst')
    ->add_fields([
        Field::make('complex', 'krct_pst_content', __('Product Tab'))
            ->add_fields([
                Field::make('image', 'icon', __('Button Icon'))
                    ->set_value_type('url'),
            ])
    ]);

Steps to Reproduce the Problem

  1. Create and save an image in a post.
  2. Migrate the database to a different domain using WP Migrate DB
  3. Load the page where you set the images, the preview images still use the old domain and won't be loaded.

Comments

I don't know why the frontend is using the URL to load the image details in first place. I currently don't have any time, but I assume the URL is set in the database instead of the ID.

I think this might be an issue relating to #635. Some people still seem to have that issue and I think that might be the problem here.

dhalucario avatar Nov 10 '21 15:11 dhalucario

I have a similar problem without migration. Pure WordPress. Installed only the carbon fields plugin. After loading the image, it is not visible from the admin.

olegvalko-dev avatar Nov 26 '21 07:11 olegvalko-dev

I have a similar problem without migration. Pure WordPress. Installed only the carbon fields plugin. After loading the image, it is not visible from the admin.

Huh, that sounds interesting. What domain are you using and which one is actually being loaded? Could it be that you are using some kind of plugin that rewrites the URL? Like a https plugin or something?

dhalucario avatar Nov 26 '21 22:11 dhalucario

This issue is not related to domains. I'm saying that the image field doesn't show a preview of an already uploaded image

olegvalko-dev avatar Nov 27 '21 09:11 olegvalko-dev

This issue is not related to domains. I'm saying that the image field doesn't show a preview of an already uploaded image

I'm not an maintainer, but would you be able to elaborate a bit more on your issue so we can try to get it sorted out? Would you be able to show me the error that occurs in the dev tools console, in the browser you are using?

dhalucario avatar Nov 28 '21 13:11 dhalucario

I have done some tests and it seems to be indeed not related to the migration.

dhalucario avatar Nov 28 '21 14:11 dhalucario

I see image ID in database after save post. But image preview stay missing. You can see video - https://www.loom.com/share/4d3c0584177c4edc87c921b311f54092

olegvalko-dev avatar Nov 28 '21 16:11 olegvalko-dev

I have the same problem. How can I fix it?

mihdan avatar Nov 28 '21 16:11 mihdan

I see image ID in database after save post. But image preview stay missing. You can see video - https://www.loom.com/share/4d3c0584177c4edc87c921b311f54092

I see that its in the database but I need to see what the error in the devtools console says to help you.

dhalucario avatar Dec 16 '21 21:12 dhalucario

Guys, I found a solution to this problem, install the plugin version 2.2.0 2018-03-16T09:20:19, this is the only solution for those who do not want to get into the code.

Filonov404 avatar Jun 02 '23 13:06 Filonov404