Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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'];
}
Comment | File | Size | Author |
---|---|---|---|
#5 | patch.patch | 652 bytes | jdelaune |
#1 | imagecache.patch | 491 bytes | jdelaune |
Comments
Comment #1
jdelaune CreditAttribution: jdelaune commentedHere is a patch if needed
Comment #2
drewish CreditAttribution: drewish commentedwhich imageapi toolkit are you using?
Comment #3
jdelaune CreditAttribution: jdelaune commentedgd2? is that what you mean?
Comment #4
drewish CreditAttribution: drewish commentedI think it should be stripped down to just:
Comment #5
jdelaune CreditAttribution: jdelaune commentedStripped out one line more. Can add it back but I don't think it's needed.
Comment #6
drewish CreditAttribution: drewish commentedthanks, committed to HEAD.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.