By zach harkey on
I've almost got the image.module working just right.
The problem is, the "Original Image" view breaks my layout... bad. I still want to keep the original image size as a viewable option, but is has anyone figured out a way to have it open in a blank page or another window instead?
Comments
sections.module gets me real close...
Ok, I think it might be possible to do this with the sections.module. I created a separate theme with a page.tpl.php template layout that can handle the "original image" size (no sidebar, no fixed width, etc.), but I can't seem to get it to kick in when I load an original image.
Using node 11 as an example, the path when viewing an original image is:
/node/11?res=original
In "administer > settings > sections ", I can't figure out what to enter under "Pages". I've tried "?res=original", "*original", and every combination I can think of.
I know the module is working correctly because when I enter "node/*" the section template kicks in perfectly.
I know $#@! about regex so I might be missing something obvious, but I've applied everything I can find that works with the blocks.
Anyone have any ideas, or is sections.module not even the right direction to achieve these results?
: z
Guess not
Well, I tried my best to make the sections.module do this but no dice. Any ideas?
: z
Very quick look
I took a very quick look and did not see an obvious way to do this. You have 2 real choices.
Do it through the theme you are using, of which I don't see a way to differenciate between link types. Perhaps some custom stuff with a phptemplate based theme .....
Add/change code in the image module. My cursory glance through the image module did not discover where the original image code link was generated. So this may not be easy.
-sp
---------
Test site...always start with a test site.
Drupal Best Practices Guide
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
I'd like to this exact same
I'd like to this exact same thing in 4.6. Can you help me how to go about it?
---
http://creativebits.org
Bump. Any solution to
Bump. Any solution to this?
Is there no way the new image.module will allow the original size images to be viewed in a pop-up? It would be essential for fixed width themes!
---
http://creativebits.org
No solution...but a direction...
So I'm going to assume based on the date of the original post that we might be talking about the original image.module as oppose to the new one walkah has been working on...
looking at the code, where you want to tweak it is in the
image_link()function here:that last line is the key. This adds the link to the original image to the array of links using drupals built in link creation function l () (that's an 'L', lower case ;) ). You can check out how that works here
http://drupaldocs.org/api/4.5/function/l
An easy way - not pretty mind you - would be to just add the
target=\'_blank\'in place of the blank array ('array()') argument - this is the attributes argument for the l function.The more difficult way would be to completely rewrite that link using some inline java script code that calls a .cab containing standard java browser window box stuff...
In this instance you will have do a bunch of work to figure out what the imageurl is to pass to the java script ect...
If I had more time I would dig into this more, as it is functionality I too would find interesting... however I'm pretty tapped out right now... :(
Hope this helps,
Cheers
~Tat~
Thanks for the guidance, but
Thanks for the guidance, but I was actually looking for a solution for the new image.module (for 4.6) as I stated in my message above. Hopefully walkah will have time to give some hints on this one.
---
http://creativebits.org
Hey, no problem...
...still not sure what the original poster was using though - I probably should have pressed reply on the first post so mine nested more appropriately... ;)
4.5.2
Original poster here; using 4.5.2
4.6 is not out yet, and even when it is out, it's going to be a while before many of us who depend on certain modules are going to be able to depend on this for professional use, so let's focus this thread on a solution for the current release.
: z
4.5.2 is history. 4.6 is
4.5.2 is history. 4.6 is around the corner. it doesn't make sense spending time on 4.5.2 hacks anymore. let's focus this thread on 4.6 ;)
---
http://creativebits.org
Sigh
The whole reason for the thread is because I need a solution now, not 'around the corner' when 4.6 is out and all the modules I'm dependent on are updated and working.
This is for a real-life, paying client who can't understand why I can't duplicate the functionality found in so many other gallery systems (i.e. the full size version opening on its own page, instead of wrecking his beautiful fixed-width page design).
So please don't argue the validity of finding a solution that works with the current version, it's not helpful.
: z
All
All right
---
http://creativebits.org
So did this work for you?
...Speaking mostly to zachharkey, so that when other 4.5.x users are searching the forums and get to this node they can at least find an answer after swimming through the FUD...
[~Tat~ cops a wicked a** chesire grin]
Verdict still out
I have to admit, your solution is a little advanced for me. I seem to be hung up in the documentation for the l() function. I'm still trying though.
-zach
: z
Do this...
this should work...
Stefan, where do i paste
Stefan, where do i paste this code please! Sorry to be so bumb! :)
---
http://creativebits.org
Looks like line
Looks like line 224
-sp
---------
Test site...always start with a test site.
Drupal Best Practices Guide
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
cool. just one last
cool. just one last question. which file? :)
---
http://creativebits.org
image.module
-sp
---------
Test site...always start with a test site.
Drupal Best Practices Guide
-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide
lol
I'm glad you asked.
-zach
P.S. I wonder how small these threaded boxes can get.
: z
Cool! Got it working under
Cool! Got it working under 4.5.2. But the image opens within the theme. We'd like to open just the image, not an html. Is that possible?
The ultimate would be to direct the original image link to a new template page that is non fixed width. How to do that?
---
http://creativebits.org
I got it
i experimented and came up with a slight variation on stefan's line:
instead of
try
It will output a link that links directly to the image.
-z
: z
I think it will work if the
I think it will work if the clean urls are on. How would this hack look like if the clean urls are not on?
Right now it gives an unnecessary "/?=node" part like this:
http://mydomain.com/?q=node/images/70ea0d7a8601137d79eedaeecb741f31-63.jpg---
http://creativebits.org
My bad,
My bad, I forgot to strip off the 'node/' part,
Should be
: z
Sorry to be such a pain in
Sorry to be such a pain in beep, but with clean urls off i still get an unnecessary "?q=". However at least the /node is gone. :)
---
http://creativebits.org
No sweat
No sweat, you're not a pain at all.
In your case, I'd give up on this l(); function. Instead just bust it out in straight html and be done with it...
So, to recap in case you have gotten lost. Ignore everything above and instead do this:
In image.module (somewhere around line 227), replace:
with this:
This will bypass drupal's ?q= shenanigans altogether.
If this works, please let me know. But I tested it with clean URLs off and it works fine for me. By the way, I'm sure you have your reasons but I just have to ask, why don't you turn clean urls on? They're so... clean.
: z
Thanks. We've implemented
Thank you very much! We've implemented your solution on 4.6. You can see it here, it works great:
http://creativebits.org/node/1124
---
http://creativebits.org
Using 4.6 and Image 1.146.2.9
I had to use this solution:
$links[] = l(t('view original'), 'files/'.$node->images['_original'], array("target"=>"_blank"));would there be a way to make
would there be a way to make the "View original" Link a image instead of just plain text?? I tried everything to make it a image but it just won't work...
Can somebody lead me on a trace...??
You could try to create a
You could try to create a new language and replace the words with an image tag. Never tried it, but you may want to give it a try.
---
http://creativebits.org
uhhh, i dont get what you
uhhh, i dont get what you mean, can you elaborate on that? How could I include that in the image.module file??
You know you can have
You know you can have language translations in Drupal. You create a new language and you can replace all strings in your Drupal site to other strings. For example you can replace "recent posts" to "track changes". The same way you may be able to change "recent posts" to an img tag i guess. Never tried it...
---
http://creativebits.org
uhh, yah i think i
uhh, yah i think i understand what you mean, ill try to take a look at it, but i dont think i will manage to get it right, as I am prety much a newbie when it comes to php strings...
Image hack
I did some hack at image module, you could check it at http://www.nodigas.com.ar/node/233 The hack is explained in spanish at http://www.nodigas.com.ar/files/cambios_image.txt, just two changes:
1. Code change at node_image_content function, just to render a javascript for a new window.
2. Code change at image_link, to call another javascript for open a new window with image at original resolution.
luck..//
If you want to view the
If you want to view the image directly you can do this by using image/view/{nid}/original with the new one. with the old version instead of original you need to put image/view/{nid}?res=original
I think that is correct for 4.5 but not 100%
--
Gordon Heydon
Heydon Consulting
--
Gordon Heydon
A Quick Hack
I know this issue has been lying around for a while, but this is what I did to the image.module file to make the 'original' link direct users to just an image with nothing else:
on line 242 (this is version 1.1) change:
$links['image_size_original'] = array('title' => t('original'), 'href' => 'node/'. $node->nid, 'query' => 'size='. IMAGE_ORIGINAL);TO:
$links['image_size_original'] = array('title' => t('original'), 'href' => 'image/view/' . $node->nid. '/_original');Thats perfect
Thanks kevee, it's an easy way and works perfectly.
Thanks Kevee, that worked
Thanks Kevee, that worked for me too - drupal 5.1-
Works, but how to impliment in own window/tab?
Your solution works great to present the image by itself in the browser window, but it fills the parent browser window or tab. I'd like for the URL that is built for "original" have a target of _new or _blank? Anybody have any ideas?
Thanks