Closed (won't fix)
Project:
Acidfree Albums
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Aug 2007 at 10:31 UTC
Updated:
16 Jan 2011 at 21:42 UTC
Jump to comment: Most recent file
Comments
Comment #1
dagomar commentedOk guys,
I have found a way to do this. But i am new to drupal, so i am not sure this is the right way to do it! If the thickbox module is installed it needs a link with the class "active thickbox" to make it work, so i decided to make a small change to the code in "class_image.inc" in the acidfree module folder. On line 63 the following line can be found:
$image = l($image, $path, array('title' => $node->title), $p, 'size=_original', true, true);
l() is the function that creates links in drupal (and what a wonderfull function it is at that!) And all i needed to do is send an extra attribute and a different link, like so:
$image = l($image, file_create_url($node->images[IMAGE_ORIGINAL]), array('title' => $node->title, 'class'=>'active thickbox'), $p, NULL, true, true);
This will make the thumbnail in album view open the original image in thickbox. This is not so much a patch; it is more a hack. I am now going to figure out more about how thickbox is converting the links automatically. Thickbox has the following option: "Enable for image nodes; Automatically activate Thickbox for all image nodes (requires the image module)."
It would be better if the option to use thickbox is set in thickbox and not hardcoded in class_image of acidfree. So, when i find out how that can be done, i will return to make a better proposal for the code here.
thanks for any help!
Comment #2
dagomar commentedHi all,
well after a long time of trying to figure this out, i finally got it to work. I had to change 2 files; class_image.inc and acidfree.module. Only 2 lines are affected.
in class_image.inc line 63:
Original: $image = l($image, $path, array('title' => $node->title), $p, NULL, true, true);
Change: $image = l($image, $path, array('title' => $node->title, 'class'=>'active'), $p, 'size=_original', FALSE, TRUE);
in acidfree.module line 2648:
Original: $attributes['class'] = "image $label". (isset($attributes['class']) ? " ". $attributes['class'] : "");
Change: $attributes['class'] = "image image-$label". (isset($attributes['class']) ? " ". $attributes['class'] : "");
I hope someone could explain to me if this is done right. It seems to work though!
Comment #3
lakyljuk commentedHi,
thanks for this. I need integrate thickbox and Acidfree too and I am happy you found some solution. I dont care, if it is clean or not, if it is working! Would be nice to have some Acidfree option to turn thickbox on and off.
Comment #4
lakyljuk commentedHi.
I did some testing with yours changes to acidfree:
1) it is not working for images inserted via acidfree inline filter - it only loads in thickbox thumbnail itself
2) when I go to my albums, I have to click the NAME of album and not the THUMBNAIL IMAGE of album, because if I do so, only thumbnail of album is loaded into thickbox and nothing else.
3) If I enter the album via its name, I can click any photo and it is properly loaded into thickbox, navigation back and forward is working.
So this solution is promising, but not perfect. I and my users are used to click at album's thumnails, so it would be confusing.
But you are on the right way, so please hold on, I hope you'll find something.
lakyljuk
Comment #5
dagomar commentedHi,
i should have updated this, but i forgot when i got it to work. I don't know about your issue with inline images, in fact, i don't know what u mean by that, but i'll have a look at that later. I made some other modifications on acidfree so it took me some time to figure out how i did it again. If i am not mistaken here the update:
No change is needed for class_image.inc! The original acidfree one is fine, the modification i made there proved unnecessary. The only modification i made is in acidfree.module line 2648:
Original: $attributes['class'] = "image $label". (isset($attributes['class']) ? " ". $attributes['class'] : "");
Change:
if ($attributes['class'] == ''){
$attributes['class'] = "image image-$label". (isset($attributes['class']) ? " ". $attributes['class'] : "");
}
I hope u can confirm this solves the issue for album thumbs opening the full image instead of leading to the album.
Comment #6
lakyljuk commentedHi.
I appreciate you are still working on it. Thanks.
Tested now your latest modification to acidfree.module, but I have to report it still has the same bug - When I click on album's thumbnail, I am not moved inside album, but I see thickbox loading large version of this thumbnail. To get inside album, I have to click album's title, not album's thumnail. Inside album, everything is working as expected - clicking at any photo gives me Thickbox with navigation. Only problem which remains is clicking at album's thumbnail.
Can you help?
lakyljuk
Comment #7
dagomar commentedYes i can!
I am so sorry, when i figured all this out, i forgot to write everything down properly. And when i got it to work, i just moved on, i am so busy lately. I hope this will be the last to get it to work, otherwise just ask again. You need to make an adjustment to class_album.inc too, on line 423:
change:
$image = _acidfree_image_display($image_node, 'thumbnail', array('id' => "acidfree-thumb{$node->nid}", 'title' => $album_info, 'width' => $info['width'], 'height' => $info['height']));
into:
$image = _acidfree_image_display($image_node, 'thumbnail', array('id' => "acidfree-thumb{$node->nid}", 'title' => $album_info, 'width' => $info['width'], 'height' => $info['height'], 'class' => "image $label"));
i hope it helps. Could u say what is going on with the inline images?
Comment #8
dagomar commentedI just figured out how to do it with inline images. I never used inline images before so i didnt know what you were talking about. It is quite easy to use thickbox plus inline pictures, no need to alter the code... just use this:
[acidfree:nnn class='image image-thumbnail']
That will trigger thickbox. I like this method, because it gives you a per image option to go to the node or not.
Comment #9
lakyljuk commentedTake a deep breath ..... Yeah, it's working! :)
Album thumbnail and album title will take me inside album, where I can click thumbnails and get thickbox effect. Nice.
Inline pictures - this option works too, thanks.
What I have realized:
1) When I am looking at thumbnails inside album, I realized, that thumbnail itself will trigger thickbox, but it's title doesn't. I personally click always thumbnails, but some user could click thumbnail caption instead, so they would see normal node with enlarged picture, no thickbox. It's just the minor bug, but if you know some easy fix, would be nice.
2) When I have for example one inline acidfree image thumbnail inside story, without thickbox, after click I am taken into enlarged version with option to go backwards or forward in enlarged photos. This is normal AF behaviour. When we have added thickbox to inline images, after click, thickbox is triggered, shows enlarged photo, but I cannot see the rest of the album. I typically have 20 or more pictures in album, one of them attaching as AF inline thumbnail into story. So in this case, if want to see rest of the pictures, I cannot use this inline thumbnail as entry to album. So what to do? I have idea - change AF, so clicking inline thumbnail wouldnt trigger thickbox, wouldnt show me enlarged one, but would take me into the album, this thumbnail belongs to. Then I would be able to click thumbnails and trigger thickbox for browsing them all.
Anyway, thank you again, you did a nice job.
lakyljuk
Comment #10
pillarsdotnet commentedFor those who are confused by all the statements/retractions/corrections, here is the result, coded as a unified diff.
As it happens, class_image.inc is the only file that needs to be changed.
Comment #11
lakyljuk commentedHi pillarsdotnet,
you are absoutely right that it is enough to change only one line in class_image.inc. But it still doesn't solve case, when user click thumbnail TITLE and not thumbnail itself. If I click thumbnail I see thicboxed enlarged image, but when I click thumbnail caption, I see only normal enlarged picture, no thickbox. Can this be unified somehow? And also - inline image tag [acidfree:xxx class='image image-thumbnail'] will show me thickboxed enlarged image, but only this one. I am not taken into album this image belongs to and I cannot browse rest of the pictures.
Thanks for your patch anyway.
Comment #12
pillarsdotnet commentedlakyljuk writes:
Short answer: no.
Longer answer:
It's possible, but you'd have to modify the thickbox.js file. Thickbox is triggered specifically when you click on an image which is of class "image-thumbnail". It extracts the image path from the image object and modifies it to obtain the path to the larger copy. You can't extract an image path from a piece of text. I suppose it could work backwards in the DOM object list until it *does* find an image, but it's just easier to remove the link from the text than to make it work the same way as the image.
Anyhow, I don't **want** the behavior you describe. I **like* being able to click on the text and get to the picture node. How else would I get there?
Comment #13
lakyljuk commentedLets say you are right - is would be easier to remove link from caption than to tweak thickbox.js to accept the text link for displaying original image. You say you _don't want_ to have link displaying thickbox too, same as thumbnail does. That you wouldn't be able to reach normal image node ever. Umm, what about to go to /acidfree, select appropriate album, select Album contents and edit image nodes? No thicbox is launched and you can move these nodes, change their title, rotate them etc.
Comment #14
pillarsdotnet commentedlakyljuk wrote:
Actually, I was wrong. After reading through thickbox.js, I believe that it is *possible* to have a link display a thickbox popup, by setting the "onclick" attribute, but I'm just not motivated to figure it out right now. See http://drupal.org/node/136153
lakyljuk wrote:
That, of course, is an option, but again, it comes down to personal preference. I don't like the "Album contents" editing mode. I find it cumbersome.
Anyhow, if you want your pictures displayed differently, you of course are free to implement your own theme override.
Find the "theme_acidfree_print_thumb_image() function in the acidfree/class_image.inc file.
Copy it into the template.php file in your theme directory.
If your theme is called "foo" then rename your copy of the function to "foo_acidfree_print_thumb_image()".
Find the line that says:
Change it to whatever suits you best.
Comment #15
lakyljuk commentedSure, I am far from forcing anyone on my preferences :) I am grateful for pointing me out to elegant theme override of thumbnail image's look. Thanks.
Comment #16
Unnamed_Hero commentedMy solution for this is
find
function _class_image_view_alter(&$node)in modules/acidfree/class_image.inc
and change
$image = l($image, "node/{$node->nid}", array(), 'size=_original', null, null, true);to
$image = l($image, file_create_url($node->images[IMAGE_ORIGINAL]), array('title' => $node->title, 'class'=>'active thickbox'), $p, NULL, true, true);Thickbox window appear when clicking on preview image in album (not in album list or on random image module).
Comment #17
soundsational commentedMany thanks for this patch. But it only works when you click on the thumbnail link. Has anyone managed to make it work for the ablum photos? (the photos that show up before the pignation appears).
thanks,
Comment #18
deanx0r commentedHere's a method that works perfectly for me. Just using some suggestions / changes in this thread, all I had to do was add the following function to my template.php (**nothing** had to be changed with any of acidfree's files)....
Just replace:
function phptemplate_acidfree_print_thumb_image(&$node, $parent=null)
with whatever is appropriate for your theme.
I've coded it so you can navigate to the next and previous images via Thickbox. If you don't want this functionality, simply replace this line:
... with this ...
Comment #19
zywieco commentedA-Ha!
just subscribing
Comment #20
greymoth commentedIt is possible to remove the image title altogether, so that there is no way to view the full sized image in the "normal" way. Just remove the
<p> $title </p>from the function in comment #18. I described this here:http://drupal.org/node/162257#comment-797344
Comment #21
mwheinz commented