How can i add a link image field instead of the upload image field?

Comments

nancydru’s picture

Status: Active » Postponed (maintainer needs more info)

I don't understand what you mean by "link image field" and "upload image field".

chasz’s picture

instead of uploading to drupal, can we have a field that displays an image from URL ?

nancydru’s picture

Title: link image field? » Link to external image
Status: Postponed (maintainer needs more info) » Active

This is an interesting idea. Technically the only real difficulty I can imagine would be in the UI and the update code that would be needed.

chasz’s picture

if you use an "if" clause to detect which of the fields is populated, you can pass the URL to the image Tag ?

nancydru’s picture

"which of the fields"? There is only one column in the table for the path. BTW it is limited to 255 characters as well, and a URL can be much, much larger than that. To do this right, one should check to see if the link actually works before just accepting it. And, then, of course, I don't like the way the database table is constructed and this change is a good excuse to fix it. Finally, I have to decide if this is an add-on or part of the core module (I prefer an add-on).

If you want to take a shot at it, feel free to submit a patch.

nancydru’s picture

Status: Active » Postponed
nancydru’s picture

Chasz, I have actually started on this. I have discovered that ImageCache cannot handle resizing an external image, but TI native resizing can.

chasz’s picture

very cool thanks alot

there snippets using php that can resize an image using GD2, rather resizing through html tag

nancydru’s picture

There is also an Image Resize module. However, for right now, I'm okay with just using height and width in the HTML.

nancydru’s picture

Status: Postponed » Postponed (maintainer needs more info)

Another thing I have thought of is to just copy the external image to the current site, then it's no longer an external image and all the normal stuff works. This also has the benefit of not linking to the source site, which is often forbidden by that site's owner.

nancydru’s picture

Assigned: Unassigned » nancydru
Status: Postponed (maintainer needs more info) » Fixed

Fix committed to 6.x only.

chasz’s picture

that option is nice to have, but there are plenty of free image hosting site we can use

nancydru’s picture

Well, you have this ability now.

Status: Fixed » Closed (fixed)

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