When specifying allowed file extensions for images (i.e. changing it to only allow JPEGs), the displayed values on the node create form are incorrect.
This is what's displayed when uploading an image:

Allowed Extensions: jpg
Must be an JPEG, PNG or GIF image

I don't know why it still says PNG and GIF, but they shouldn't be there...

I'm using CCK v6.x-2.x-dev (2008-Oct-02) and Imagefield v6.x-3.0-alpha2.


mike_r1977’s picture

I can confirm this error. This is because imagefield calls a filefield function, where the values are hardcoded:

function filefield_validate_is_image_help() {
  return t('Must be a JPEG, PNG or GIF image');
BWPanda’s picture

Title: File extensions listed incorrectly » Hard-coded file extensions
Project: ImageField » FileField
Version: 6.x-3.0-alpha2 » 6.x-3.x-dev
Component: Miscellaneous » Code

Moving to the FileField issue queue.

File extensions displayed on node creation forms need to match the chosen extensions, not be hard-coded.

dopry’s picture

@mike_r1977: can you write a patch for it?

dixon_’s picture

Is the function filefield_validate_is_image_help() necessary at all? It just duplicates information.

dopry’s picture

Status: Active » Postponed (maintainer needs more info)

@dixon_: I don't know... I just put it there for fun... why don't you read the code and tell us.

As for the help text... It's limited to what FileField will potentially support, but I agree it may be nice to pass some context into the help callbacks, but what am I going to do? implement cases for each possible file extension? any great ideas besides objections?

BWPanda’s picture

I might have misunderstood what you're asking, but can't you just have some sort or array that lists the different file extensions, then loop through that for validation and help text display...?

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Postponed

This is corrected in #397578: Uncouple ImageField from FileField Custom Hooks. Marking postponed until that patch is committed.

quicksketch’s picture

Status: Postponed » Fixed

I went ahead and committed #397578: Uncouple ImageField from FileField Custom Hooks, there was too much held up by its changes.

quicksketch’s picture

Title: Hard-coded file extensions » Hard-coded file extensions "Must be a JPEG, PNG or GIF image"

Status: Fixed » Closed (fixed)

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