Here is a version of this module I have ported for Drupal 7. Tested and appears to work just fine with the latest version of IMCE (7.x-1.6).

Comments

Rory’s picture

StatusFileSize
new7.76 KB

I accidentally left some stuff in for a custom public files directory I was running. Try this version instead.

steve.colson’s picture

Status: Needs review » Needs work

Why did you add new_file to _imce_unzip_scale_image, rather than relying on $file being passed in with the correct settings?

Rory’s picture

$new_file just grabs what it needs from $file being passed in. Do you mean that during the function, we should just keep using $file and update it instead of using $new_file?

I introduced operating on a copy of the file instead of the original file and wrote in the variable $new_file as it made sense to visualise the path from the temporary files directory to replacing the original image.

ydahi’s picture

StatusFileSize
new32.93 KB

Hi Rory, thanks for the port.

I'm getting a 500 internal server error (screenshot attached). Running IMCE 7.x-1.7, IMCE Mkdir 7.x-1.0, and the module in #1 above.

Looking at the apache error logs I see

PHP Fatal error: Call to undefined function file_directory_path() in /var/vhosts/mediaflow/sites/all/modules/imce_unzip/imce_unzip.module on line 102, referer: ...

Function in question:

/**
 * unzip a file in the file list.
 */
function imce_unzip_file($filename, &$imce, $delete_zip_file) {
  $filepath = file_directory_path() . ($imce['dir'] == '.' ? '' : '/' . $imce['dir']) . '/' . $filename;
  if (file_exists($filepath)) {
    $file = new stdClass();
    $file->filename = $filename;
    $file->uri = $filepath;
    $file->filemime = file_get_mimetype($filename);
    return _imce_unzip_file_unzip($file, $imce, $delete_zip_file);
  }
  return TRUE;
}

Any help would be greatly appreciated.

ydahi’s picture

StatusFileSize
new6.51 KB

Did some digging around and it seems that file_directory_path() is no longer included in D7 (almost): http://drupal.org/node/930082

Replaced instances of file_directory_path() with file_stream_wrapper_get_instance_by_uri('public://')->getDirectoryPath();

Unzip working fine now.

Rory’s picture

Status: Needs work » Needs review

Thank you very much @ydahi! That was a much needed fix! I'll mark this issue as needing review.

I'm waiting on some elaboration from @stephen.colson. He has pointed out some further work is required, and I'm not quite sure what that is. Comments from anyone else are welcome to help me out.

shabbir’s picture

hi,

@ydahi thanks for the fix, i am using this module now. @Rory if any issue found i will surely mark it over here. Till then thanks both of you..

Cheers,
Shabs

steve.colson’s picture

I just stamped out a dev version for this issue. Sorry for the delay folks!

steve.colson’s picture

Assigned: Unassigned » steve.colson
Issue summary: View changes
Status: Needs review » Closed (fixed)

Thanks Rory and Ydahi, marking fixed.