使用PHP Codeigniter将图像上传到Cloudinary [英] Upload image to Cloudinary using PHP Codeigniter

查看:115
本文介绍了使用PHP Codeigniter将图像上传到Cloudinary的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮助我如何使用CodeIgniter将图像上传到Cloudninary吗?我不知道如何将Cloudinary安装到CodeIgniter并使用它,因为我是PHP CodeIgniter的新手。请帮我谢谢你。

Can someone help me how to upload an image into Cloudninary using CodeIgniter? I don't know how to install the Cloudinary to CodeIgniter and use it because I'm new to PHP CodeIgniter. Please help me thank you.

更新!我能够解决。请参阅第一个答案。欢呼声

Update! I was able to solve it. See the first answer. cheers

推荐答案

此代码对我有用

Cloudinary::config(array(
    "cloud_name" => "cloud_name",
    "api_key" => "*****",
    "api_secret" => "*****"
));

$image = UploadedFile::getInstanceByName('file');

$cloudinaryImage = Cloudinary\Uploader::upload($image->tempName);

$entity->setFile($cloudinaryImage->url);

这篇关于使用PHP Codeigniter将图像上传到Cloudinary的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆