0
votes

I'm having trouble with making a complex action with a CCK field.

The user provides a video id; then, using a cck compute field, i'm generating the unique hash to find the thumbnail of the image on the remote site; then, i don't know how to do this, but i want to 'fill up' a field (image type) with downloaded thumbnail and displayed with an image cache preset.

So my question may be dumb, but, how can I 'automatically' add an image to a image field using simple php function (that i'll put in the calculated cck field)

Use actions ? Or any other idea ?

1

1 Answers

1
votes

Embedded Media Field works with ImageCache. It pulls the source image from a remote site, and can display it through imagecache instead of directly to the screen.

Using this approach, rather than computed field I would create an em field on the node, but hide it from the user. Instead, the user sees a text field for video ID, which is transformed on hook_nodeapi() presave op to populate the hidden em field.

If instead you do need to directly download your image, I would check out the FileField Sources module. It facilitates the user entering a remote url that will then be downloaded to the server. Perhaps you could use it as a sort of inspiration for your own small module to achieve this, or depending on how it's written, an API for your use.