In php 5.5 i get error "Deprecated function: curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead in imageapi_optimize_services_smushit() (line 32"

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jcisio’s picture

Status: Needs review » Needs work

It should keep it compatible with PHP < 5.5 too. Maybe something like this (from php.net):

if (!function_exists('curl_file_create')) {
    function curl_file_create($filename, $mimetype = '', $postname = '') {
        return "@$filename;filename="
            . ($postname ?: basename($filename))
            . ($mimetype ? ";type=$mimetype" : '');
    }
}
blesss’s picture

Status: Needs work » Needs review
FileSize
1.29 KB
919 bytes

Added compatible with PHP < 5.5

pbz1912’s picture

I get the following error with the patch in #2 applied, when images are generated:

Notice: Trying to get property of non-object in imageapi_optimize_services_smushit() (line 55 of /vagrant/webroot/sites/all/modules/imageapi_optimize/services/smushit.inc).

id.tarzanych’s picture

Developed another version of patch providing compatability with PHP 5.5 and lower versions

alexander.sibert’s picture

I will test it.

hctom’s picture

Status: Needs review » Reviewed & tested by the community

Patch from #4 works like a charm and applies cleanly to 7.x-1.2. Marking this as RTBC, because this issue is opened way too long already ;)

rootwork’s picture

Status: Reviewed & tested by the community » Closed (won't fix)
Related issues: +#2333345: Deprecated function: curl_setopt(): The usage of the @filename API for file uploading is deprecated

Smushit no longer exists. #2458453: Smush.it service has changed so it is no longer available to the module replaces it with Resmushit, and the new process doesn't include this bug. Given that, marking this as won't fix -- apply the patch in that issue instead.

rootwork’s picture