By default, when using an Image Cache preset, File Field Inset adds width and height attributes.
Is there anyway to disable this?

I think adding width and height attributes limits flexibility. For example, if I decide to change the size of image cache images in the future, the width and height attributes will keep the images stuck at their original size.

Comments

quicksketch’s picture

Status: Active » Closed (duplicate)

There is a patch for this request at #505420: Calculate width and height attributes when inserting ImageCache images, which I plan to include.

big_smile’s picture

Status: Closed (duplicate) » Active

Actually, my issue is different from #505420.

#505420 is about correcting the width and height attributes that are inserted in the HTML code. My issue is about removing them altogether.

As I said in my original post, I think adding width and height attributes limits flexibility. For example, lets say I create a preset called text_images, which insets the images at 500px by 500px. However, a couple of months later, I decide I want these images to be 600px by 600px. I can re-size the images easily enough in one go by modifying the image cache preset. However, all the images I have inserted with file field insert will be stuck at 500px by 500px, because that value is hard coded into the HTML of each page.
(unless of course, I am not understanding something about how fie field works).

quicksketch’s picture

Status: Active » Closed (duplicate)

The patch in #7 (which I plan to include) solves the problem by removing the height and width, even though that's not what the issue was originally titled.

quicksketch’s picture

Status: Closed (duplicate) » Active

Ah, wait. That patch will only remove the height/width if it doesn't already exist. Hmm. In your case then, if you don't want height/width, just remove them from the filefield-insert-image.tpl.php file.

quicksketch’s picture

Project: FileField Insert » Insert
Version: 6.x-1.x-dev » 6.x-1.0-beta1
Status: Active » Fixed

I've fixed this by removing the width/height entirely from ImageCache presets in the new Insert module, which replaces FileField Insert. Please try out the new module and let me know if there are any other problems with height/width in the new version.

big_smile’s picture

Status: Fixed » Closed (fixed)

Hi

I've tried out the new Insert module and it works perfectly, so I guess this issue can be closed.

Thanks for all your help. ^_^

geerlingguy’s picture

Status: Closed (fixed) » Active

Is there any way that width/height could be added to the imagecache-insert-image.tpl.php template, if I wanted to use it (maybe this title should be "Optionally remove...")? I have a preset that still uses the original size image, but is able to set a class on an image for automated captioning; however, if a width is not set on the image, then the caption will expand to contain all the text in the caption...

I've had to manually set a width on the image each time I insert an image, and this is quite tedious as I have to go into my Mac's Finder and get info on the file to see the dimensions.

Thanks!

quicksketch’s picture

There's no reason why you couldn't do this *if the image was an exact size every time*. That is, if you have a "Scale and crop" or a "Resize" action that puts the image at an exact size. We got into this whole trouble because ImageCache images do not necessary exist at the time they are inserted. So if you want images that are 300px wide, you have no idea how tall the image is going to be once it's been scaled by ImageCache, since you don't know the ratio of an image that hasn't yet been uploaded.

geerlingguy’s picture

Ah, that's the trouble, though; the imagecache preset doesn't do a resize (necessarily), so sometimes the width would be incorrect... :(

quicksketch’s picture

Status: Active » Closed (duplicate)

Let's consolidate this with #505420: Calculate width and height attributes when inserting ImageCache images. They're both for the same thing.