I'm attempt to use the ImageField module in CCK. I added the ImageField to the content type however when I go to upload the image I get the following error: The selected file admin.jpg could not be uploaded. The file is not a known image format. I checked and the file extension is list under permitted upload file extension.

Can someone advise me how to fix this problem?

Thank you so much!

Comments

Yuri Ingultsov’s picture

this is an issue of image module (see image.inc line 116 image_get_info($file) {..... } ) the issue caused by is_file($file) call. see http://ua2.php.net/manual/en/function.is-file.php for details

actually you have to change image.inc by hand.

jfinkel’s picture

Used in a simple test, image_get_info() works just fine.

Consider this little PHP script:

<?

/* copied from image.inc line 116 */
function image_get_info($file) {
  if (!is_file($file)) {
    return FALSE;
  }

  $details = FALSE;
  $data = @getimagesize($file);
  $file_size = @filesize($file);

  if (isset($data) && is_array($data)) {
    $extensions = array('1' => 'gif', '2' => 'jpg', '3' => 'png');
    $extension = array_key_exists($data[2], $extensions) ?  $extensions[$data[2]] : '';
    $details = array('width'     => $data[0],
                     'height'    => $data[1],
                     'extension' => $extension,
                     'file_size' => $file_size,
                     'mime_type' => $data['mime']);
  }

  return $details;
}

echo '<pre>';
print_r(image_get_info('sites/default/files/banner.jpg'));
echo '</pre>';

?>

Returns:

Array
(
    [width] => 771
    [height] => 102
    [extension] => jpg
    [file_size] => 83450
    [mime_type] => image/jpeg
)

Yet, I cannot upload any image files, small or large. Directory permissions are fine. Any suggestions as to how to fix this (IIS 6.0).

vivianspencer’s picture

Did you ever find a fix to this? I'm having the same issue under IIS 6.0

voross’s picture

I am also having sort of the same issue:
1. Cannot upload images with the standard image module, as there is no upload button, and when click on save, I receive error message "Only image formats jpeg, gif, or png are allowed",
2. If creating a new content type for images with CCK, then I have the same as vivianspencer or the above.
3. Maybe Interesting thing, if I ftp up the picture, it can be added to a gallery without issues.

drupal 6.16
IIS 6.0
PHP Version 5.2.13
MySQL version 5.0.51a

markshust’s picture

Just go to content type > x > manage fields, edit the image field, and on that screen you will see config options for file extensions.

rutiolma’s picture

I got the same problem under IIS 7.0, but with APACHE everything works fine.
Don't know the problem... but it's not a image extension configuration problem.

antoniotorres’s picture

Having this issue as well on IIS, no luck yet.

Anonymous’s picture

I spontaneously started having this issue as well. Worked fine until this evening...

subscribing