Thanks! That helped me get past that issue. Now, I am getting this response when trying to add the image:
Code:
Array
(
[errors] => Array
(
[0] => Array
(
[0] => unexpected_error
[1] => Upload failed. PHP upload error: 0
)
)
)
My test code looks like this:
Code:
// This line does add the node for the album
$albumId = $api->callApi('content_gallery', 'add', array('data' => $data, 'options' => $options));
// Here, I get the info on a test file to try and add programatically
$fileName = '/var/www/mydomain.com/gw/photos/Architectural/wallpaper-1st-id-arch.png';
$fileParts = pathinfo($fileName);
$imageName = $fileParts['filename'];
// I don't want to lose the original file, so I copy it into a tempfile, to simulate uploading it
$tmpName = tempnam('/tmp', 'INC');
copy($fileName, '/tmp/' . $imageName);
rename('/tmp/' . $imageName, $tmpName);
$fileInfo = array();
$fileInfo['uploadFrom'] = 'profile';
$fileInfo['parentid'] = $albumId;
$fileInfo['tmp_name'] = $tmpName;
$fileInfo['name'] = $fileParts['basename'];
$fileInfo['size'] = filesize($fileName);
$fileInfo['type'] = 'image/png';
$photos = array($fileInfo);
// Upload the file and add it
$response = $api->callApi('content_attach', 'upload', array('photos' => $photos));
print_r($response); exit;
Any ideas?
--------------- Added [DATE]1492129123[/DATE] at [TIME]1492129123[/TIME] ---------------
Ok, I got past that problem. I needed to just pass 'file' => $fileInfo and do away with the $photos bit I was trying.
At any rate, it does "upload" the image, but now I need to somehow get it to show up in the gallery. I'm thinking I need to do something like this:
Code:
$response = $api->callApi('content_photo', 'add', ..... );
Just not sure what to pass to it.
--------------- Added [DATE]1492129263[/DATE] at [TIME]1492129263[/TIME] ---------------
Tried this, but to no avail:
Code:
$response = $api->callApi('content_photo', 'add', array($albumId, array('filedataid' => $response['filedataid'])));
I get this error:
Code:
Array
(
[errors] => Array
(
[0] => Array
(
[0] => invalid_data
)
)
)
--------------- Added [DATE]1492129526[/DATE] at [TIME]1492129526[/TIME] ---------------
Also, I noticed that in the vb_filedata table, that it had resized my test image (scaled it down). Is there some way to prevent that? These need to stay in their native 1920x1080 resolution. Thanks!