Hello -- I find I'm perplexed and vexed, and could use suggestions from anyone with a bright idea.

In one particular instance, I'm using Asset along with CCK to associate an image with a node. The image is to be a custom banner image for the page. It does not appear within the node's body content, nor is there any way to do what I need by that method. (Figures, right?)

Using CCK I added the field, as an Asset "widget". All of that is jim dandy; piece of cake.

My migraine is resulting from the output. When the node is loaded, I get everything under the sun except what I actually need, namely:

  • Best case: the complete file path, including the sub-directory the image is in
  • Alternatively: just a plain' ol' image tag with ALT text...and nothing else.

What I do get is:

  • the asset id
  • something labeled "options", which is the filename...but not with the file directory path
  • caption text (if any)
  • * copyright text (if any)
  • a rendered view, which is the image wrapped in a bunch of HTML and inline text

Visiting the Asset Formatter Defaults panel gives no joy. Under "All Types", the only option available is "Link"...which I assume (perhaps incorrectly) is what's forcing my formatting woes? Anyway...no help there, alas.

It seems very peculiar that I get the file name, but not its location in the asset directory tree. Hence my deduction that I'm just dorking something...or perhaps CCK is killing me with kindness? Sure, I could use the asset id to retrieve the path...but the page in question is already overly expensive and I seriously need to avoid any further data queries, even trivial ones.

So...

  • Am I just doin' something wrong? If so, how should I be doing it?
  • Regardless, how can I get just a danged full file path for my image asset without an additional DB call? :-)

Thanks most kindly...

Comments

wmostrey’s picture

Without an additional db call, you can not (currently). You should use asset_load() on the aid you're provided. You do have a point that it doesn't make absolute sense to provide the aid and the filename but not the filepath. I'll take a look at how the image module is handling this for instance. Suggestions are always welcome.

spencersundell’s picture

Hi wmostrey --

Thanks much for the information. Though a little disappointing for me, at least I know how I can proceed.

Much obliged...

Jeff Burnz’s picture

@spencersundell could you outline how you proceeded with this, I to only want the plain old image path and not all the other stuff that comes with it.

spencersundell’s picture

@jmburnz -- I'm afraid I did as directed and had to resort to using asset_load() to fetch the full web filepath to the desired image.

In my case, the path is all I needed -- I'm using it in CSS to custom-override a header image (which I'm implementing as a background), and the thing has a fixed size. If I'd needed the image's dimensions as well, I would then do a call to PHP's getimagesize function (which requires that GD be installed as well, of course...I forget what the ImageMagick equivalent is).

Hope that's helpful...

wmostrey’s picture

Status: Active » Closed (won't fix)