Move images from a custom field to post_images

This topic contains 19 replies, has 3 voices, and was last updated by  Kiran 4 years, 7 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #541061

    vivek
    Full Member
    Post count: 246

    Hi, I was using a custom field (files) for image (one per listing) as i needed custom fallback rules which was not possible at that time. So i was using gd_post_meta shortcode to display the image in a custom field (key: image_test)

    Now with fallback_types option available, i don’t need to use the custom field and I want to use the post_images (as that has advantages eg image shows in embed/opengraph, which custom field does not).

    How can i move all the existing images in the field ‘image_test’ to the field ‘post_images”?

    thanks, Vivek

    #541062

    vivek
    Full Member
    Post count: 246

    Also, i just realised yesterday that the fallback_types allows me to do what i could not earlier. I had in fact asked about the fallback order about a year ago (https://wpgeodirectory.com/support/topic/post_images-fall-back-order/) and at that time it was suggested to use a custom field with gd_post_meta.

    Somehow i missed noticing the update when the fallback_type was introduced, and just saw it yesterday – i do usually look at the update list before updating (though much of it is “don’t understand”or “not relevant”), but is there a better way for me to know about such changes?

    thanks, Vivek

    #541084

    vivek
    Full Member
    Post count: 246

    Tried to export> copy the image_test to post_images > import

    that did not work…i have max one image in each listing, so the URL is like :

    https://www.staging37.kidwise.in/wp-content/uploads/2020/03/87602824_689170185159403_1003242684615229440_n.jpg|558||

    pasted it in the post_images and imported but that does not work, again exporting shows post_images blank

    Any suggestions please, thanks

    #541108

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    In post images try

    
    
    
    https://www.staging37.kidwise.in/wp-content/uploads/2020/03/87602824_689170185159403_1003242684615229440_n.jpg|||
    
    #541198

    vivek
    Full Member
    Post count: 246

    Hi Alex, tried that – didnt work.

    Attaching the csv in which i had exported, and added the URLS in post_images. GD shows records updated but the featured image / post_images is not updated. Do I need to add :: but i thought that is only for multiple imgs..

    #541203

    vivek
    Full Member
    Post count: 246
    This reply has been marked as private.
    #541449

    Alex Rollin
    Moderator
    Post count: 27815

    Have you tried it without the browser protection on?

    I can’t login to check it because of the browser protection.

    #541498

    vivek
    Full Member
    Post count: 246

    Hi Alex, yes i was importing wihtout the browser protection. have turned it off so you can check please.

    thanks,vivek

    #541525

    Kiran
    Moderator
    Post count: 7069

    Hi Vivek,

    There is easy way to move images from custom fields to post images via manually from database.

    Here are the steps:
    – Go to database & browse database table DB_PREFIX_geodir_attachments
    – Update attachments table column type and change it to post_images (Ex: change image_test to post_images in type column)
    – Save blank value for the image_test column in detail table.

    After doing this all the images will be displayed under post images.

    Make backup first before doing this.

    Let us know.

    Thanks,
    Kiran

    #541528

    vivek
    Full Member
    Post count: 246

    Thanks, Kiran – will try this. But i am not clear about hte last step – “– Save blank value for the image_test column in detail table.” Does this mean that each record in each of the DB_PREFFIX_CPT_detail tables in column image_test i shall need to save a NULL individually? or did you mean something else?

    Since i wont be needing the “image_test” column anyway now, is it okay if i skip the last step, and just remove that custom field in CPT settings, after doing the first 2 steps?

    thanks, Vivek

    #541530

    Kiran
    Moderator
    Post count: 7069

    Does this mean that each record in each of the DB_PREFFIX_CPT_detail tables in column image_test i shall need to save a NULL individually?

    Yes

    You can delete “image_test” custom field after making value of image_test field for each posts. Otherwise it will delete images uploaded under image_test custom field. In short you must save empty value for image_test before removing that custom field.

    Thanks,
    Kiran

    #541541

    vivek
    Full Member
    Post count: 246

    Ok, got it. Thanks very much, Kiran.

    #541550

    vivek
    Full Member
    Post count: 246

    Hi Kiran- so that worked for getting the images into post_images, however the image is not getting set in featured_image for the post. I have only one post_images so GD should make that featured image, but thats not happening?

    thanks, Vivek

    #541555

    Kiran
    Moderator
    Post count: 7069

    There is some extra functionality to set image as a featured. Try to re-save the listing and let us know how it goes.

    Steps i provided just moves images from custom field to post images. It does not set featured image.

    Thanks,
    Kiran

    #541558

    vivek
    Full Member
    Post count: 246

    Okay – saving the listing does not set the featured image. So what is the way to do that now?

    will i need to set the featured image in the DB also?

Viewing 15 posts - 1 through 15 (of 20 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount