It would be nice to be able to specify a URL, a file, or both (configurable in the field edit screen). This would help make it easier for users to upload small pictures like logos from web sites without having to first download them to their systems, then upload them again. I think it should work by using the URL to download a copy and keep a local cache of the image.

Comments

dopry’s picture

Version: 4.7.x-1.x-dev » 6.x-3.x-dev

I will not be doing this for the 4.7 release of imagefield. It may come in 5.0 then be back ported.

jmav’s picture

Is this already supported

dopry’s picture

no not yet supported. You could write a new widget to do this...

scroogie’s picture

Would this also be a good way to implement the often requested "Reuse image"-feature? I mean accepting URIs and decide what to do per schema (upload for file://, download for http:// and reuse for local filename)?
What do you mean with writing a new widget? A completely new field module or would it be an extension to imagefield? Sorry to ask, but I'm confused by the nomenclature.
Or don't you wan't this feature at all in imagefield?

Gábor Mayer’s picture

jpetso’s picture

Title: URL Instead of File » Use image from arbitrary URL

Renaming to something that I could more easily understand among all those "link" withlist items.

jpetso’s picture

Issue #265999: 3rd party website image upload was marked as duplicate of this issue.

scroogie’s picture

It would be nice if someone answered my question in either this thread or the Re-use of existing images thread. It's not a request, it's just a question.

jpetso’s picture

> It would be nice if someone answered my question in either this thread (...)

Er, sure. Let's see...

> Would this also be a good way to implement the often requested "Reuse image"-feature?

It would be a functioning workaround. I don't believe it would be a good way to implement "Reuse feature" - the latter should reference existing file ids in the database instead of new file entries, and is therefore technically a quite different thing. Not sure which one is easier to implement, they're both doable once someone feels motivated to do so.

> What do you mean with writing a new widget?

Widget in this context means CCK widget. CCK essentially consists of three pluggable parts: "fields" (provide the data), "widgets" (provide the edit form elements) and "formatters" (provide the rendered HTML for the node view). A new widget would mean replacing the current "file list plus upload field" with a "file list plus URL field" widget that still provides an imagefield but just uses another method to get the data into Drupal.

> Or don't you wan't this feature at all in imagefield?

No, I believe we want this. The question is more, how important is it, and when will any developer find the time to code it.

zach harkey’s picture

The Embedded Media Field module provides this functionality through its Embedded Image Field component. Unfortunately their implementation is exclusive to external images.

The ideal solution would be to have a universal image field that would provide basic upload or specify a URL for an image to import. Then allow additional modules like Embedded Image Field to extend - rather than replace - its functionality. Afterall, at the node level all you want is an image. Whether or not the image is uploaded, imported, locally hosted, hotlinked, etc. should be determined on a per image basis.

Richard_’s picture

Zach Harkey, as far as I read project page, Embedded Media Field module provides this funcitonality with limited number of sites: Flickr, Picasa, Imageshack and Photobucket...

Or does it work with any picture URL?

I am also looking for the imagecache solution for thir part images pasted with URL, because imagecache is wonderfull image handler.

nicolash’s picture

subscribe

nicolash’s picture

Dopry, am I correct that you'd actually accept the approach of downloading an external file as an option?

I initially wanted to add that functionality to emfield, but the more I thought about it the less I liked it, simply because it would try to turn part of emfield into imagefield....see http://drupal.org/node/187555

I started over there with a mini module, but never got any feedback, so I'd like to make sure I won't waste my time again if it's not even desired behaviour and destined to rot in the issue queue.

How I could see this working is that if a full URL is given, it downloads the file and creates the equivalent as if one would have uploaded it. I had a look through the imagefield code, but couldn't see anything obvious that I could use to download the file...am I correct with this? Everything seems to be geared towards the upload process.

If so, would the following approach be the best way to go?

* Download image via drupal_http_request() into same folder.
* Insert/update a DB entry directly into the files table.
* Insert/update a DB entry directly into the imagefield fields referencing the files entry.

Next time the node would be edited, there wouldn't be any difference to the contents of imagefield if it would have been uploaded as usual.

Richard_’s picture

I have paid programmer to build this functionality into imagefiled.
It is already working, with replaced upload functoinality. Now he needs to integrate both - upload and URL options within imagefield.

I will release module here (entire module or maybe patch - he never done patch for Drupal) also for dopre to inlcude it into official imagefield.

I do not require, but if you are willing to chip-in please contact me, I will be happy to share some cost :)

jpetso’s picture

I noticed that there's a new module called Link Image Field which provides a new (different) CCK field type for URL-referred images. That would resolve this issue, except if you need to use either standard imagefield or linkimagefield images in the same CCK field.

jpetso’s picture

Status: Active » Postponed (maintainer needs more info)

...which raises the question: close or don't close this issue?

nicolash’s picture

jpetso, that module seems to do something quite different to what this issue is about?

This was about being able to use an external image file with imagefield, creating a local copy in the process so other modules like image_cache will still function.

scroogie’s picture

What I also thought is that being able to use arbitrary URLs would simplify interfacing to one of the image browsers like Image Assist.
In one of my sites, it is very common to reuse an article image. For example an abstract image thats just symbolic, because the article isn't suited for screenshots or photos. Of course the Link Image field would be suited to copy/paste the image URL, but the author would have to search for the previous post first to find the URL. I don't think thats comfortable.

HansBKK’s picture

Title: Use image from arbitrary URL » Use image from arbitrary filepath or URL

+1 on doing this within imagefield rather than creating yet another image-handling CCK field type.

Pending better ideas, I like IF handling this transparently by parsing the arbitrary string (not just URLs) in the upload file box (widget?)

Let me put in a path like:

D:\aasync\My Documents\Personal\graphics\hh-avatar-original.jpg

or

file://shb3\shbadmin\Marketing\Newsletter\current%20working%20-%20shared\from%20Hans\0810\ex%20cathedra\0810-ex-cath-2133-lg.jpg

or

http://www.yahoo.com/favicon.ico

and IF uploads the file and leaves the reference exactly as if the user had uploaded the file the way IF works now.

Ideally the browser would let me switch from "local file" to web browser, but I bet that would make it a lot harder (cross platform issues), so let the user just copy and paste the path from wherever to start with.

And I also bet this feature request has nothing to do with re-use, due to the limitations in core's underlying file-handling routines (correct?). But if/when the day comes that multiple fields/nodes can reference a given file already in the site's filesystem (ideally "owned" by any module, not just imagefield) then of course the same UI interface should handle re-use as well (making the browser yet even more difficult :)

zersaa’s picture

subscribe

emlomar1’s picture

+1

giorgio79’s picture

Been looking for this as well.

Specify a URL in the upload filed, create a local copy and apply all the transformations as per a regular upload, like renaming etc.

NikkelDrup’s picture

Looking for the same thing...

Any suggestion ?

udig’s picture

Looking for this widget as well.

sphism’s picture

Sounds great, this is exactly what i'm looking for.

What's the progress?

Seems like Richard_ has a completed module

I'd be happy to chip in a few bucks towards it.

Sam Dark’s picture

Status: Needs work » Postponed (maintainer needs more info)

I want this one also. We did the same for old D5 versions with some dirty hacking year ago…

quicksketch’s picture

Status: Postponed (maintainer needs more info) » Postponed

This a completely different use-case than ImageField is able to support and should be implemented as a separate module. The official stand-point on this is "won't fix". I'm marking it postponed so that it will continue to show up in the normal issue view and keep duplicate issues from being opened.

Updates that include a patch to add this functionality will be considered, however do not reopen this issue or mark it as active without a patch. The maintainers of this module currently have no plans to implement such a feature.

Sam Dark’s picture

Status: Postponed » Needs work

I've partly implemented custom widget type for image cck fields that will provide functionality needed.

Done with defining widget, delegating common functions to imagefield and adding custom URL field.

Right now I don't know how to hook to upload form submission (but before filefield handles it).

Anyone interested to work on this one or help with imagefield / filefield APIs?

Source: http://rmcreative.ru/files/drupal/urlupload.zip

Sam Dark’s picture

Something tells me it's not possible without creating new compound field type.

quicksketch’s picture

You might take a look at the ImageField Crop project, which builds on the normal ImageField widget but adds cropping ability. Make sure you work off of HEAD for all the modules, since they've been significantly rewritten since alpha4.

Sam Dark’s picture

Status: Postponed (maintainer needs more info) » Needs work

Me and my colleague implemented it as a new module. While I'm applying to CVS you can get it here: http://rmcreative.ru/files/drupal/urlupload.zip

quicksketch’s picture

I'm also interested in this feature, though it's discouraging that every new feature added to File/ImageField needs to be a separate widget, meaning you have to choose (for example) between an IMCE widget, a remote URL widget, a widget that lets you crop the image, a widget that lets you rotate, etc.

This patch for CCK introduces a new approach which would allow you to have a widget that combines all these features from separate modules. #417122: Allow drupal_alter() on Field and Widget Settings.

Sam Dark, this looks pretty interesting, though the code doesn't follow Coding standards, which will make it harder for you to get a CVS account. It should also be generalized to work with FileField, and you should use drupal_http_request() to support users without CURL (unless you can implement something CURL specific, like progress bar support).

quicksketch’s picture

Status: Needs work » Postponed

There is an in-progress module in the #119539: FileField Sources: Remote files / Reference existing files issue. Please do not post further comments here.

quicksketch’s picture

Status: Postponed » Fixed

Please see http://drupal.org/project/filefield_sources. File any new issues in that module's issue queue.

Status: Fixed » Closed (fixed)

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

Isostar’s picture

+ 1 subscribe