UPDATES EasyDiscuss 4.1.18 Released! Additional tools for antispam and other awesome refinements 🤺 🐛


I am following your own code examples for creating a post in code. The problem is that the "image" field in the post data never accepts anything I give it. Clearly you do a bunch of processing on images before setting this field.

Since you support programmatic posting, would you please provide a code example on how to use this field? I can have the image uploaded and on a path, or I can provide a URL. Either is fine.

But I need to know how to set this to get a post cover image in the post via code, please.

$postdata['image'] = $image; // This line does nothing!

My code:

public static function Post($userid, $category, $categories, $image, $postType, $content, $permalink, $posttitle, $tags, $description, $keywords)
$author = JFactory::getUser($userid);

$post = EB::post(null, $author->id);

$createOptions = array('checkAcl' => false,
'overrideAuthorId' => $author->id);

try {

catch (Exception $ex) {

echo "Failed to create post!


echo $ex->getMessage();

$postdata = array();

$postdata['uid'] = $post->uid;
$postdata['permalink'] = $permalink;
$postdata['title'] = $posttitle;
$postdata['tags'] = $tags;
$postdata['keywords'] = $keywords;
$postdata['description'] = $description;
$postdata['created_by'] = $author->id;
$postdata['created'] = EB::date()->toSql();
$postdata['modified'] = EB::date()->toSql();
$postdata['publish_up'] = EB::date()->toSql();
$postdata['source_id'] = 0;
$postdata['source_type'] = EASYBLOG_POST_SOURCE_SITEWIDE;

if ($postType == 'post') {
$postdata['published'] = EASYBLOG_POST_PUBLISHED;
else {
$postdata['published'] = EASYBLOG_POST_DRAFT;

$postdata['frontpage'] = 1;
$postdata['doctype'] = EASYBLOG_POST_DOCTYPE_LEGACY;
$postdata['posttype'] = EBLOG_MICROBLOG_EMAIL;
$postdata['send_notification_emails'] = 0;
$postdata['category_id'] = $category;
$postdata['categories'] = $categories;

$postdata['image'] = $image;

$postdata['content'] = $content;

$post->bind($postdata, array());

try {

$saveOptions = array(
'applyDateOffset' => false,
'validateData' => true,
'useAuthorAsRevisionOwner' => true

catch (Exception $exception) {

echo "There was an exception saving the post!


echo $exception->getMessage();

return $postdata;

This section can only be seen by users with a valid subscription.
If you have a valid subscription, please login now

Your time
Stack Ideas HQ
Support is

The support team is online and will be able to answer your inquiries. Please stay calm, follow the rules and do not cross post.

We will attend to you as soon as we can.

Buy Us Coffee

Are you happy with our support and would like to buy us a cup of coffee?

Enjoy the Coffee!
Service via PayPal
Subscribe for product updates & promotions