Found an issue with imagecache_transfer();

mime_content_type(); was returning text/plain for all my PNG images. However ImageAPI and getimagesize() were returning the correct mime type image/png. Since imagecache requires ImageAPI would it not make sense to use their function to find the file mime type.

Sorry I would write a patch but here is the code I changed mine to. Works great for me.

function imagecache_transfer($path) {
  if (function_exists('imageapi_image_open')) {
    $image = imageapi_image_open($path);
    $mime =  $image->info['mime_type'];
  }
  else {
    $size = getimagesize($path);
    $mime = $size['mime'];
  }
CommentFileSizeAuthor
#5 patch.patch652 bytesjdelaune
#1 imagecache.patch491 bytesjdelaune
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jdelaune’s picture

Status: Active » Needs review
FileSize
491 bytes

Here is a patch if needed

drewish’s picture

which imageapi toolkit are you using?

jdelaune’s picture

gd2? is that what you mean?

drewish’s picture

I think it should be stripped down to just:

$size = getimagesize($path);
$mime = $size['mime'];
jdelaune’s picture

FileSize
652 bytes

Stripped out one line more. Can add it back but I don't think it's needed.

drewish’s picture

Status: Needs review » Fixed

thanks, committed to HEAD.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.