我正在尝试在我的服务器中上传后压缩图像,所有内容都按预期进行,但是当我将更改从本地计算机上传到在线服务器时会出现此错误
Call to undefined function Tinify\curl_version()
so my source code in my local machine below ...
require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify/Exception.php');
require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify/ResultMeta.php');
require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify/Result.php');
require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify/Source.php');
require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify/Client.php');
require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify.php');
\Tinify\setKey("4R8QNHlOax0Mcp7lho4QiOBUnTjJuZYj");
if($this->upload->do_upload("file")){
$imageDetailArray = $this->upload->data();
$pic = $imageDetailArray['file_name'];
$unoptimized_img_loc = 'uploads/'.$pic;
$img_url = base_url() . "include/" . $unoptimized_img_loc;
try {
$source = \Tinify\fromFile($img_url);
$optimized_img_name = 'compressed_imgs/users_profile_pic/profile_pic'.$pic;
$resized = $source->resize(array(
'method' =>'fit',
'width' => 300,
'height' =>300
));
$resized->toFile($_SERVER['DOCUMENT_ROOT']."/html/include/".$optimized_img_name);
}catch (\Tinify\Exception $e){
print_r($e);exit();
}
$dataIn['logo'] = $optimized_img_name;
}
并且相同的代码上传到我的VM服务器但不起作用
请帮忙 并提前感谢,
答案 0 :(得分:2)
确保在 php.ini (或者 curl.ini ?)中激活了卷曲:
extension=curl.so
添加后,重新启动您的网络服务器。
您缺少已安装的卷曲包。例如安装 php-curl 。
您没有提及您的操作系统和版本,但在这里您可以找到安装和配置详细信息:http://php.net/manual/en/book.curl.php
下面,来自https://board.s9y.org/viewtopic.php?f=4&t=20857的引文具有相同的casus:
我在上传安装了新插件的图片时遇到此错误:/ {/ 1 / vps.hommel-net.de/serendipity/plugins/serendipity_event_tinypng/tinify-php/lib/Tinify
Fatal error: Call to undefined function Tinify\curl_version()
第11行上的/Client.php。此错误后图像位于媒体库中,但未压缩。你有可能没有php curl模块有效吗?像php-curl这样的包? 我将看看Tinyfy-Client是否真的需要它,但这是可能的。
就是这样。 debian包是php5-curl。安装后,错误消失了。
It seems that the API of TinyPNG has counted my tries with the error, too.
请记住,TinyPNG的API会计算您的请求数量!
答案 1 :(得分:-1)
switch (node.kind) {
case ts.SyntaxKind.InterfaceDeclaration:
// Process interface declaration node by going deeper in another function
break;
// And so on...
}