Closed (fixed)
Project:
Colorbox
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
12 Apr 2010 at 07:52 UTC
Updated:
10 Dec 2010 at 08:50 UTC
The Insert module is a nifty solution to insert image field images inline in the body.
It is simply done by implementing to new hooks, colorbox_insert_styles() and colorbox_insert_content(). For styling the link to insert we reuse theme_colorbox_imagefield().
Lightbox modules like Lightbox2 and Fancybox already have this built in. That's where I found out how to do it so cred to them.
Comments
Comment #2
gooddesignusa commentedThis seems to work correctly. The only issue i've found is.
1.Upload an image
2.Leave title and alt blank.
3.Insert image into wysiwyg and save.
If you also have cck displaying the fields you will notice the wysiwyg image has no title set. The cck version has the title of the page. The logic checks the title and alt and if neither is set it uses the page title.
I wonder why the wysiwyg version isn't the same since they both call the same thing?
Not really a critical issue but figured i would let you know.
Comment #3
frjo commentedThe reason is that hook_insert_content() doesn't provide a node object or a nid.
We could make a feature request about this to the Insert module.
Comment #5
gooddesignusa commentedI think i found an issue using insert. If you go to a node and upload an image. Add title & alt text. Then insert it using a colorbox preset. You will notice the alt and title tags do not get inserted. Now insert the image using a non colorbox preset. If you check the alt and title on that image it was in fact inserted. In order to get colorbox preset to work you need to fill out the alt and title tags , save the node and then re edit it. Then it correctly adds the title and alt info.
Is there any way around this? Can we somehow make it so the user would not have to save the node first before we can access that info? I'm guessing its because drupal doesn't know whats inside those fields yet. Does the normal insert use javascript to grab that info?
Thanks in advance
Comment #6
frjo commentedComment #7
milos.kroulik commentedsubscribe
Comment #8
milos.kroulik commentedsubscribe
I suppose we could use Custom Formatters (http://drupal.org/project/custom_formatters) in the meantime (I didn't test it personally).
Comment #9
frjo commentedThe Insert module solves this with a bit of JavaScript that replaces placeholders like __alt__ with the values as needed. I believe Colorbox can reuse it.
When I get some time (could be a month or two) I will implement this in Colorbox.
A patch would be most welcome.
Take a look in these files:
insert.module
imagecache.inc
imagecache-insert-image.tpl.php
Comment #10
gooddesignusa commentedNo luck on my end. I'll see if I can figure it out tomorrow.
Comment #11
shopdogg commentedsubscribe
Comment #12
lolmaus commentedSubscribing
Comment #13
magnus commentedSubscribe
Comment #14
frjo commentedI have just committed code to 6-dev that extends the integration with Insert module. There is now a colorbox-insert-image.tpl.php file with placeholders for title and alt. This allows alt and title to be inserted before the node has been saved, just like the Insert module built in functions work. The Colorbox module simply reuses the JavaScript that the Insert module includes.
Please try it out and report your results here.
I would like to include this and #955868: New Colorbox style and code to easily add new styles in a beta 8 release.
Comment #15
gooddesignusa commentedThanks frjo. I'll try to test this out within the next week or so. I have some modules to update on a site that uses Insert.
Comment #16
dagmarUsing beta-7, I cannot use the inserted alt and title when I clicked on 'Insert', now it seems to be working fine.
As a note, clear the cache is required when update to 6.x-1-x-dev. Nice work @frjo.
Comment #17
frjo commented