BigBoiJefe
Chevereto Member
Hi, i'm using the api, however, I need to know if there's a way to pass a title of the uploaded image? If this does not exist, how much to add this?
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:
Support response
Support checklist
Nope. Check the API source code to get an idea.I have no idea what that means. Is there an example?
$uploaded_id = CHV\Image::uploadToWebsite($source, NULL, NULL);
public static function uploadToWebsite($source, $user, $params=[]) {
$image_insert_values = [
'storage_mode' => $storage_mode,
'storage_id' => $storage_id, // nota: real storage id
'user_id' => $user['id'],
'album_id' => NULL,
'nsfw' => $params['nsfw'],
'category_id' => $params['category_id'],
'title' => $params['title'],
'description' => $params['description'],
'chain' => $chain_value,
'thumb_size' => $image_thumb['fileinfo']['size'],
'medium_size' => $image_medium['fileinfo']['size'] ?: 0
];
$uploaded_id = CHV\Image::uploadToWebsite($source, NULL, NULL);
$uploaded_id = CHV\Image::uploadToWebsite($source, NULL, ['title' => $_REQUEST['title']]);
$uploaded_id = CHV\Image::uploadToWebsite($source, NULL, ['title' => $_REQUEST['title']]['album_id' => $_REQUEST['album_id']]['category_id' => $_REQUEST['category_id']]['user_id' => $_REQUEST['id']]);
public static function uploadToWebsite($source, $user, $params=[]) {
try {
if($user) {
switch(gettype($user)) {
case 'string':
$user = User::getSingle($user, 'username');
break;
case 'integer':
$user = User::getSingle($user);
break;
}
}
$uploaded_id = CHV\Image::uploadToWebsite($source,NULL,['title' => $_REQUEST['title']],['category_id' => $_REQUEST['category_id']]);
Can I pass user_id in the $_REQUEST?
Not the album, as you may notice it doesn't pass the album id in the $params array. I will have to modify that.
Yes. You can pass anything. Just check the code and notice that the user_id must be passed as the second parameter of the function.