When I add image via editor I can't set background image to aper over the colorbox link image. Is there any solution ?

Comments

batigol’s picture

I have got similar question. After watching very good tutorial - http://www.youtube.com/watch?v=QUcjbmKJdh8&feature=mfu_in_order&list=UL

I want to add background image to little images I put in editor (just like in the movie) but also want to style colorbox iframe with rounded corners. Could any of drupal guru explain this subject ?

BTW colorbox is great ! I like it for it's customization options. However I can't add link for download original image and I don't see options to no use colorbox but to display images in new window (after clicking in miniature) Is this possible with colorbox ?

kerios83’s picture

You can style colorbox iframe by adding css code to #cboxTopLeft #cboxTopCenter #cboxTopRight etc. divs. U can style it however you want (even background over image by setting optional z-index). But I'm not able to set background over image when working with those colorbox thumbs... If somebody know the way, please post it here (BTW this youtube movie is very nice - I have spend two hours before trying to install insert additional to colorbox to display thumbs in editor, it's a pity I didn't found it earlier:)

batigol’s picture

Thanks I had finally done it !

dqd’s picture

#batigol: I don't need that feature discussed here, but by passing by the issue I saw you asking and making compliments to the module and leaving with "I finally done it". ... uhm ... thanks for sharing.

Well, please don't get me wrong, but this is not how a community works. Coming in, asking for a "Guru" and finally leaving with an "Did it my way, but thanks". For others who pass by this issue it would be helpful, when you take the 10 minutes time to show a step-by-step how you did it. Otherwise the maintainers of colorbox will have 20 "done it my way, bye" with the same request in the queue ...

thanks for understanding

batigol’s picture

@ Digidog Hi, I had done it just like @kerio83 said. I don't know how to describe it better. I think you should read post more carefully.

Also thanks to @kerios83 PM I have managed to make those thumbs (insert module) as a background images. I leave it to him to describe this process or if he agree I can do that later on. Soon I will make all those changes on my live site so u can see it in action.

Also if any of you reading this, do have any questions, just ask them, so we know that there are more ppl want to know the answer/are interested or want to test some code.

kerios83’s picture

@batigol @digidog no problem. You can set colorbox iframe over the image by adding z-index value to #cboxBottomCenter, #cboxBottomRight etc. like I said before.

Making thumbs as a background images is a little bit more tricky. You need to add Content: Link (and Content: (Your-Gallery-Image) off course) to your views and in Content: Link Rewrite results - Rewrite the output of this field add something like this:

[field_gallery_image](you gallery field image) and check Output this field as a link - Link class and add there (your-class-name2)

in your css file:

.view-id-(your-view-name) .views-field-view-node .field-content a.your-class-name2
{position:relative;}

.view-id-(your-view-name) .views-field-view-node .field-content a.your-class-name2 .your-class-name1
{position:absolute;
width:Xpx;
height:Xpx;
background:url('../your-bg-image.png')center no-repeat;
margin:-Xpx;}

Now you can see that all of your thumb images are set as a background of your-bg-image.png ! I hope it helps, if something is unclear let me know.

off course u can use colorbox-insert-image.tpl.php to achive something similar:

EDIT: added some example code you can modiffy:

<span class="class-node-bg-img">
<a href="<?php print $link_path; ?>" title="__title__" class="colorbox colorbox-insert-image" rel="<?php print $gallery_id; ?>">
<span></span>
<img typeof="foaf:Image" src="<?php print $image_path; ?>" alt="__alt__" title="__title__" class="<?php print $class; ?>" />
</a>
</span>
.class-node-bg-img
{padding:Xpx;}

.class-node-bg-img a
{position:relative;
width:Xpx;
height:Xpx;}

.class-node-bg-img a span /* only SPAN is working here... ! */
{position:absolute;
background:url('../images/your-bg-image.png')center no-repeat;
width:Xpx;
height:Xpx;
margin:-Xpx;}

but in this scenario class-node-bg-img won't be close after you add image, it will close after you add all your images. Span class is fixing it.

kelutrab11’s picture

@kerios83 Could you give us example of those kind of gallery ? I don't know what exactly are you talking guys...

kerios83’s picture

http://diablo3.progames.pro - gallery
http://progames.pro/gallery/might-magic-heroes-6 - example

BTW I have eddit the code (change few div to spans) and after fixing some FileField Path problems, IMCE and it's http://drupal.org/node/1099994 is a problem now.

spamator12’s picture

wow this is nice ! I didn't even thought thats possible to do.

lsolesen’s picture

Status: Active » Closed (fixed)

Marking as fixed as there is an answer. Could any of you do a little documentation piece for the Drupal Handbook?