• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

🙏 How to change the image randomly and automatically that appears when you post a link on Facebook?

sergiosouza

Active member
Aug 12, 2019
209
47
28
Hello everyone, everything good? I would like some help. Does anyone know any code or wordpress plugin that has the functionality to change the shared image of my website, that is, every time someone publishes the link to my website on facebook, the image that is generated must be different and not a single image.
 
Hi, Sergio.
i Think yoast could help you.

Take a look on their doc ;D


Gl, kinsman!

Hello @justcamehere , first thanks for your reply. I read what is on the link you sent, but I believe it would not be what I am looking for. What I want is a script or plugin, which randomly and automatically modifies the image that appears when the link is posted on Facebook, that is, when a person posts my link on Facebook, an image will appear (preferably that can be chosen beforehand inside a folder) and some time later when another person will post the same link on Facebook, another image will appear (which will be inside this same folder, for example). This would serve to do a type of AB test, to see which image engages the most in the publication.
 
Good morning, Sergio!
Did you already try this one?
Unfortunately this plugin does not change the image when you post the link on Facebook, it is always the first. I have a code, at the beginning of last year it worked, but I tried this week and it is giving an error. I don't know if I'm doing something wrong.
 
Put the code here, i'll try to take a look 🧐🧐🧐🧐🧐
I am testing to post, but this message appears:

Oops! We ran into some problems.
Oops! We ran into some problems. Please try again later. More error details may be in the browser console.
 
justcamehere

Would it be this:

Place this code in the header.php just below <? php
function random_pic($dir, $nf=3)

{

$files = glob($dir . DIRECTORY_SEPARATOR . '*.jpg');

shuffle($files);

return array_pop($files);

}

//$number = rand(); ?v=$number

$path = 'images';

$file_1 = random_pic($path, 1);

$image = file_get_contents($file_1);

$og_img = base64_encode($image);


and then put this code before </head>

<meta name="twitter:card" value="summary">

<meta property="fb:app_id" content="224711598334964" />

<meta property="og:title" content="This is what you need !" />

<meta property="og:type" content="article" />

<meta property="og:url" content="http://yoursite.com" />

<meta property="og:image" content="http://yoursite.com/<?php echo $file_1 ?>" />

<meta property="og:description" content="Liked it? Click Here & Get it for FREE."/>

<meta property="og:site_name" content="yoursite.com - What Do You Need?"/>

And also create a folder in your hosting called "Images" and place the images that you want to appear. I believe it would be something:
 
Last edited:
justcamehere

Would it be this:

Place this code in the header.php just below <? php
function random_pic($dir, $nf=3)

{

$files = glob($dir . DIRECTORY_SEPARATOR . '*.jpg');

shuffle($files);

return array_pop($files);

}

//$number = rand(); ?v=$number

$path = 'images';

$file_1 = random_pic($path, 1);

$image = file_get_contents($file_1);

$og_img = base64_encode($image);


and then put this code before </head>

<meta name="twitter:card" value="summary">

<meta property="fb:app_id" content="224711598334964" />

<meta property="og:title" content="This is what you need !" />

<meta property="og:type" content="article" />

<meta property="og:url" content="http://yoursite.com" />

<meta property="og:image" content="http://yoursite.com/<?php echo $file_1 ?>" />

<meta property="og:description" content="Liked it? Click Here & Get it for FREE."/>

<meta property="og:site_name" content="yoursite.com - What Do You Need?"/>

And also create a folder in your hosting called "Images" and place the images that you want to appear. I believe it would be something:
it seem you are using the ultimate google Adsense method? I am right? Can you tell me if the method still works or not?
I have seen the course. but haven't tried it yet?
 
it seem you are using the ultimate google Adsense method? I am right? Can you tell me if the method still works or not?
I have seen the course. but haven't tried it yet?
I wasn't really trying to do the method. I just wanted the featured image to change every time someone shared my link, to do an AB test
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock