• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Schedule uploading using ftp & api

SMP

💖 Chevereto Fan
Here is a small tutorial to schedule posting your images.

Step 1:
Create a folder "autoup" on server and a new file using the following code, change api_key, site_url, images_folder_path and save it as rand.php and upload it to "autoup" folder

Code:
<?php
// api key
$api_key = 'your_api_key'; //change this

// script install location
$site_url = 'http://www.yoursite.com';  //change this

// path to autoup folder
$images_folder_path = '/home/xxxx/public_html';  //change this

// folder name
$folder_name = '/autoup/';  // optional change

// extensions to be checked
$extensions = array('jpg','jpeg','gif','png','bmp');

// Images Array (SRC value)
$images = array();


// Open directory and read images
if ($handle = opendir($images_folder_path.$folder_name)) {
   while (false !== ($file = readdir($handle))) {
     if ($file != "." && $file != "..") {
       // get file extension
       $ext = strtolower(substr(strrchr($file, "."), 1));
         if(in_array($ext, $extensions)) {
           $images[] = $file;
         }
     }
   }

   if(!empty($images)) {
     $rand_img = array_rand($images, 1);
     $img_name = $images[$rand_img];
     $img_url = $site_url.$folder_name.$img_name;
     $api = $site_url .'/api/1/upload/?key='.$api_key.'&source='.$img_url.'&format=txt' ;
     echo file_get_contents("$api");
   
     if(unlink($img_name));
   }

closedir($handle);
}
else
{
echo 'No images were found';
}
?>

Step 2:
Create a cron job as required with the following command
Code:
wget -O /dev/null -o /dev/null http://www.yoursite.com/autoup/rand.php

Step 3:
From now on upload your pictures to "autoup"
 
this is very nice!

is it possible to make an image appear in facebook page automatically? thanks a lot for your helping hand!
 
Back
Top