You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 14, 2020. It is now read-only.
/*
// OLD UPLOAD FUNCTION
public function uploadAsset(AssetFileModel $savedAsset)
{
try {
\Cloudinary\Uploader::upload($savedAsset->url, [
'public_id' => $this->getAssetHandle($savedAsset),
]);
} catch (\Cloudinary\Error $e) {
$this->handleError($e->getMessage());
}
}
*/
// NEW SUPPORT FUNCTION FOR UPLOAD FUNCTION
private function getSourceFileSystemPath(LocalAssetSourceType $sourceType = null)
{
$path = is_null($sourceType) ? $this->getBasePath() : $sourceType->getBasePath();
$path = IOHelper::getRealPath($path);
return $path;
}
// NEW UPLOAD FUNCTION
public function uploadAsset(AssetFileModel $savedAsset)
{
// get the local path to asset first
$fileSourceType = craft()->assetSources->getSourceTypeById($savedAsset->getSource()->id);
$fileLocalPath = $this->getSourceFileSystemPath($fileSourceType).$savedAsset->getPath();
// upload
try {
\Cloudinary\Uploader::upload($fileLocalPath, [
'public_id' => $this->getAssetHandle($savedAsset),
]);
} catch (\Cloudinary\Error $e) {
$this->handleError($e->getMessage());
}
}`
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Thanks for the great plugin!
I came across an issue where local uploading didn't work - the plugin expects a publicly accessible server (which localhost is not).
Here's the fix for services/NpCloudinary_CloudinaryService.php
`class NpCloudinary_CloudinaryService extends BaseApplicationComponent
{
The text was updated successfully, but these errors were encountered: