

Next, open the command prompt in your project root directory and run the command: composer require tinify/tinify In this post, I will show you how to compress images using TinyPNG and PHP.įor getting started, you need to get an API key by registering with your name and email address. TinyPNG is a popular service to compress images. So what’s the solution? Optimize the images. Heavy images slow down the speed of your website. It seems that the API of TinyPNG has counted my tries with the error, too.Are you facing a site speed problem? You should then consider optimizing your website images. I will have a look whether the Tinyfy-Client really needs it, but that is possible. Is it possible that you have no php curl module active? A package like php-curl? The image is in the media library after this error but it's not compressed. I just get this error when uploading an image with the new plugin installed: Fatal error: Call to undefined function Tinify\curl_version() in /var/on line 11. You didn't mention your OS and version, but here you'll find installation and configuration details: īelow, citations from with the same casus: You're missing an installed curl package. $resized->toFile($_SERVER."/html/include/".$optimized_img_name) Īnd the same code uploaded to my VM server and that doesn't workīe sure that curl is activated in your php.ini (or maybe curl.ini?):Īfter adding this, restart your webserver. $optimized_img_name = 'compressed_imgs/users_profile_pic/profile_pic'.$pic \Tinify\setKey("4R8QNHlOax0Mcp7lho4QiOBUnTjJuZYj") Require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify.php')

Require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify/Client.php') Require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify/Source.php') Require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify/Result.php') Require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify/ResultMeta.php') So my source code in my local machine below: require_once(APPPATH.'libraries/tinify-php-master/lib/Tinify/Exception.php') I'm trying to compress image after upload it in my server and everything going as expected but when I upload my changes from local machine to online server that gives me this errorĬall to undefined function Tinify\curl_version()
