When users want to add a PDF or something else then you never want to user image styles etc. When a user now selects an image style then the user will now get an img tag with a wrong src.

Attached patch will always use the "link" format when you select a non-image file.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Johnny vd Laar created an issue. See original summary.

Johnny vd Laar’s picture

I thought that I had commit access... but I don't so the patch was made from a commit on my local repo... so it's not in the official patch layout. But I think that it'll still apply.

rudiedirkx’s picture

Status: Active » Needs work

Can't do this in 1.x, because contrib and custom will have added [4] with their own meta information. Non-existent 2.x could do it with a better data format (assoc array instead of 0-4).

Or 1.x could do it in JS: don't check file[4], but do an extension check in JS, with a new overridable JS method. I'll take that.

Thank god you don't have commit access!

Johnny vd Laar’s picture

Hmm I'll take another shot.

Johnny vd Laar’s picture

Another attempt in JS. The check is in a separate function such that someone can override it.

rudiedirkx’s picture

Status: Needs work » Reviewed & tested by the community

I like it, but I'll change inArray to just testing for (ext1|ext2)$. Later.

rudiedirkx’s picture

Status: Reviewed & tested by the community » Fixed

Voila. Good addition!

Status: Fixed » Closed (fixed)

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