Is there a way to return the filename and path the the QR code.png file? I'd like to add a link to my view to allow a user to download the png.

Thanks for a great module!

Comments

fildawg’s picture

Status: Active » Closed (works as designed)

DOH! - Sorry, somehow I overlooked the CCK/Formatter.

Buckminster_Bond’s picture

Version: 6.x-2.0 » 7.x-2.0
Category: feature » support
Status: Closed (works as designed) » Active

fildawg kindly shared the methodology that he used with me...

With custom formatters, I added a custom format (named: QR Code URL) of field type: Text with the PHP:

    $preset = 'medium';
    /**
     * Render Node URL as the path to a Mobile Code.
     */
    $node = $element['#node'];
    $url = url("node/{$node->nid}", array('absolute' => TRUE, 'alias' => TRUE));
    $request = mobile_codes_process_url($url, array('#preset' => $preset));
    return mobile_codes_generate($request);


I then used this in a view - added the QR text field and selected the format.  This presented the URL.

I wanted to share this - as it works for D6.

However, for D7, the output is, for example -

public://mobile_codes/977adeb78a4e9d58d565dcf4f2ed01fa.png

Does anyone know how to output the full path...

http://www.mysite.com/sites/default/files/mobile_codes/977adeb78a4e9d58d565dcf4f2ed01fa.png

Or better still (for my purposes) just the filename?

Buckminster_Bond’s picture

I've fixed my problem - with messy hack.

To get rid of the public:// I went into the module file itself and deleted the three instances of public://

Probably not a good thing to do (and probably breaks something else somewhere else) but at least now I can create a url that I can output to third parties - which means a happy customer.

(To create the full file path I am using views and have rewritten the results outputting as a link)

drwits’s picture

buckminster... how did you get it into your view?
my previews are working in the custom formatter edit page.... i just can't figure out how to embed it in views. any help would be much appreciated!

thanks

Buckminster_Bond’s picture

StatusFileSize
new91.8 KB

The trick was to create a new text field, which doesn't actually do anything (just a standard field in one of your content types - nothing to do with views, call it "Download Code", as an example.)

You can then bring this field into views and select the custom format as the formatter. I'll attach an image. I've made it a bit more complicated as I am rewriting it as a link. Hope this helps you...

drwits’s picture

StatusFileSize
new307.56 KB
new41.6 KB

thanks for that... not working for me

added a cck text field called "qr code"
in the custom formatter edit page... the previews are working perfectly

i can't get it to show up on nodes or views
admin/content/node-type/foo-bar/display have it set to the custom formatter option

i guess i could set up a rule to autopopulate the cck field with node title... and output it with some theming but... it seems like everybody else is able to use the custom formatter option to automatically generate the qr code from node title.

drwits’s picture

got it working...
you may ignore the above post

thanks

dkdnt’s picture

Version: 7.x-2.0 » 6.x-2.x-dev
Category: support » task

Path above does not work in version 6.2 . I think it is useful to many people, eg for use with lightbox etc.
This is a very good project, but I think is needed cooperation with the image cache or lightbox2.
Sorry for my English and I greet dkdnt

Comment "2" is a solution to this problem. sorry

deciphered’s picture

Status: Active » Fixed

Marking issue as fixed as it doesn't look like it requires any action.

Status: Fixed » Closed (fixed)

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