Adding thumbnails

No replies
Joined: 09/02/2010
Points: 24

Hi All,

I'm trying to come up with a little web app where users can input the entry ID, then generate a new thumbnail for the video (by inputting the time to snap it from) - because our end users don't get KMC access, and I don't want to be manually doing this every time.
Thus far, I'm just trying to do a basic generate, but the API isn't playing along and I'm not sure what I've done wrong.


$x = $client->thumbParams->get(19);
print_r($x);

$thumbAsset = $client->thumbAsset->generatebyentryid($entry->id, 19); //originally was $x->id, but it made no differece)
print_r($thumbAsset);

$newthumbAsset = $client->thumbAsset->add($entry->id, $thumbAsset);
print_r($newthumbAsset);

exit;

I'm getting an exception that seems odd, since the doco mentions no valid status with the value 1:

KalturaThumbParams Object ( [cropType] => 1 [quality] => 100 [cropX] => 0 [cropY] => 0 [cropWidth] => 0 [cropHeight] => 0 [videoOffset] => 3 [width] => 0 [height] => 0 [scaleWidth] => 0 [scaleHeight] => 0 [backgroundColor] => 0 [sourceParamsId] => 0 [format] => jpg [density] => [id] => 19 [partnerId] => 0 [name] => Default Thumbnail [systemName] => Default Thumbnail [description] => Default Thumbnail [createdAt] => 1327405574 [isSystemDefault] => 1 [tags] => default_thumb [requiredPermissions] => Array ( ) )

KalturaThumbParams Object ( [cropType] => 1 [quality] => 100 [cropX] => 0 [cropY] => 0 [cropWidth] => 0 [cropHeight] => 0 [videoOffset] => 3 [width] => 0 [height] => 0 [scaleWidth] => 0 [scaleHeight] => 0 [backgroundColor] => 0 [sourceParamsId] => 0 [format] => jpg [density] => [id] => 19 [partnerId] => 0 [name] => Default Thumbnail [systemName] => Default Thumbnail [description] => Default Thumbnail [createdAt] => 1327405574 [tags] => default_thumb )

Fatal error: Uncaught exception 'KalturaException' with message 'Invalid enumeration value "1" for parameter "status", expecting enumeration type "KalturaThumbAssetStatus"' in /var/www/html/kaltura/KalturaClientBase.php:457 Stack trace: #0 /var/www/html/kaltura/KalturaClient.php(3067): KalturaClientBase->throwExceptionIfError(Array) #1 /var/www/html/kaltura/thumbnail-select.php(81): KalturaThumbAssetService->add('0_4s2b23mt', Object(KalturaThumbAsset)) #2 {main} thrown in /var/www/html/kaltura/KalturaClientBase.php on line 457

I've tried using generate() instead of generatebyentryid(), but I get errors then as well:

Fatal error: Uncaught exception 'KalturaException' with message 'The property "KalturaThumbParams::id" cannot be updated' in /var/www/html/kaltura/KalturaClientBase.php:457 Stack trace: #0 /var/www/html/kaltura/KalturaClient.php(3156): KalturaClientBase->throwExceptionIfError(Array) #1 /var/www/html/kaltura/thumbnail-select.php(79): KalturaThumbAssetService->generate('0_4s2b23mt', Object(KalturaThumbParams)) #2 {main} thrown in /var/www/html/kaltura/KalturaClientBase.php on line 457

The documentation isn't terribly clear on exactly what the difference between the two functions are, or what to do with them.
Can someone tell me the correct order of function calls to generate a thumbnail for an existing entry and saving it?

Thanks,
- David