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

Status: Fixed » Closed (fixed)

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

gooddesignusa’s picture

This 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.

frjo’s picture

Status: Closed (fixed) » Fixed

The 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.

Status: Fixed » Closed (fixed)

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

gooddesignusa’s picture

I 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

frjo’s picture

Status: Closed (fixed) » Active
milos.kroulik’s picture

subscribe

milos.kroulik’s picture

subscribe

I suppose we could use Custom Formatters (http://drupal.org/project/custom_formatters) in the meantime (I didn't test it personally).

frjo’s picture

Status: Active » Needs work

The 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

gooddesignusa’s picture

No luck on my end. I'll see if I can figure it out tomorrow.

shopdogg’s picture

subscribe

lolmaus’s picture

Subscribing

Magnus’s picture

Subscribe

frjo’s picture

Title: Add basic support for the Insert module » Add full support for the Insert module
Status: Needs work » Needs review

I 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.

gooddesignusa’s picture

Thanks 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.

dagmar’s picture

Using 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.

frjo’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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