Yesterday I mentioned on http://drupal.org/node/32221 that I've been working on a rewrite of the img_assist module that makes it easier than ever to add inline images to posts. It has the exact same purpose as the original img_assist, but it offers these advantages:

- Tightly integrated with the TinyMCE WYSIWYG editor with a new drupalimage plugin. It converts the Drupal filter code into an image placeholder that the user can align and resize in the WYSIWYG editor. On saving, viewing HTML source, or changing the image (using the plugin) the placeholder is converted back to Drupal filter code.
- Set up so that integration with another WYSIWYG editor should be fairly easy.
- The image is linked using the image's NID, instead of the FID. That way if/when the image files are regenerated from the source the inline image won't be lost.
- Images can be resized to ANY size, not just a pre-defined list of standard sizes set by the image.module. The imaging toolkit (GD2, etc.) is used so the images are never resized by the browser.
- The workflow is simplified (in my opinion -- that's a preference of course).
- Mostly backwords compatible with the existing img_assist (you can't EDIT an existing img_assist tag with the drupalimage plugin, but existing tags will still work unless you try to edit them).

Please take a lot of some screenshots: http://www.benjaminshell.com/demo/img_assist.htm. You can also download it from my site. It may not be ready for a production site, but it's working great on my test site running Drupal CVS with the latest versions of TinyMCE and image.module. It seems to work on Drupal 4.6 as well.

Since it is a rewrite of the original img_assist module, with the exact same purpose of adding inline images to posts, I'm hestitant to release it as a new module. However, the changes are too extensive for patching the existing img_assist module. What do you think? What's the best way to release it?

Please let me know what you think. After reading the forums for the last couple years I've been getting the feeling that many people want a better way to insert inline images and so I'm trying to provide that.

Comments

matt westgate’s picture

Benshell and I plan to merge many of these changes into the current img_assist module for the upcoming 4.7 release. We both agreed that there's no benefit in yet another inline image mod.

The concept of co-developers (i.e., other user's with CVS commit blessings) has worked very well for me, with TinyMCE being my first attempt. I hope to do more of this, especially with the ecommerce package. (Sorry for getting slightly off-topic)

PurpleEdge’s picture

I would prefer if the fixed size option for re-sizing of images could be retained as an administrator switch based on user type.

benshell’s picture

That's interesting. I wouldn't have thought of that, but it's certainly do-able. It was a lot harder to add the functionality to let users make their image any size.

PurpleEdge’s picture

I thought fixed sizes are useful where the images have to "fit" a format for a node - makes it easy for users to upload/resize to fit the requirements?

Boris Mann’s picture

Please use my contact to get in touch.

Anyone else want to pony up a bounty to have this backported to 4.6? Unless, Ben and Matt, you can let me know if this is not possible?

PurpleEdge’s picture

Where is the appropriate place to post feature requests for modules? I have previously asked about features for this module and received no reply?

http://drupal.org/node/31882
http://drupal.org/node/31709

Boris Mann’s picture

Feature requests are just feature requests, though. The developer may not be interested in adding that feature, or may just be busy (it's only been a week since you posted).

Lisadol’s picture

hello Benjamin,
Your rewrite of img_assist is exactly what I want. Thanx a lot !
Unfortunatly, it doesn't work. When I push add an image (the camera of the first version of img-assist is no more here. Normal ?), a pop-up opens but in it, there is the message page not found.
I think that I did not install well.... But don't know how to fix the problem.

Thank you very much for your help !

Lisadol

benshell’s picture

Since posting here I've become aware of a problem with using the TEXT link with TinyMCE for adding new images... I need to talk to the authors of the TinyMCE module about a resolution. The TinyMCE module has extra code in it to support the original img_assist module, but it is interferring with the rewrite I did.

In the meantime, you can use the img_assist "add image" text link without TinyMCE; or you can use the drupalimage plugin for TinyMCE. Either one of those should work.

I'll also try to get a fix or workaround figured out for the text link with TinyMCE as soon as I can.

Thanks for trying the rewrite, and thanks for your patience.

radiofranky’s picture

Hi,
i'm having the same problem. after upload the image, the browser displays "page not found".

did u ever got it to work? could u share ur experiences? tks

Maniac8888’s picture

OK, I've downloaded your new version and unzipped the file. I'm a little confused regarding the contents. Obviously the unzipped drupalimage folder goes in the plugin folder of tinymce. No problem there.

Now, here is what I have.

tinymce.module replaces the same in the /modules/tinymce folder.

img_assist.module,
image_assist.js
image_assist.css all go in the /modules/image_assist folder

Where do the following go:
tinymce.js - someplace in the tinymce folder, but where?
textarea.js - beats me on this one. Where does it go?

Additonally, in the install.txt file, for 4.6 you reference the following:

"There is section in this function (starting around line 282
of tinymce.module) that says:

switch ($theme_name) {
case 'advanced':
$init['extended_valid_elements'] = 'a[href|target|name|title|onclick],img[class|src|border=0|alt|title|width|height|align|name]';
$init['theme_advanced_buttons3_add_before'] = 'tablecontrols,separator';
$init['plugins'] = 'drupalimage,table,emotions,fullscreen';
$init['theme_advanced_buttons3_add'] = 'drupalimage,emotions,separator,fullscreen';
break;"

But, in the tinymce.module file included in your zip file, these lines are included:

"// Add some extra features when using the advanced theme.
switch ($theme_name) {
case 'custom':
$init['extended_valid_elements'] = 'a[href|target|name|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]';
$init['plugins'] = 'drupalimage,emotions';
//$init['theme_custom_buttons1_add_before'] = 'drupalimage,emotions,separator,';
//$init['theme_custom_buttons1_add'] = 'drupalimage,emotions,separator';
break;"

Are the changes in the install.txt file to be made here? I am bit confused and that confusion has made both image_assist and tinymce inop for me.

Thanks in advance for the help.

benshell’s picture

All the files go in the img_assist directory unless otherwise noted. As you've correctly observed, the optional drupalimage plugin goes in the TinyMCE plugins directory and the replacement 4.6.3 version of tinymce.module goes in the tinymce directory. Otherwise everything goes in the img_assist directory.

As for the differences between the tinymce.module file I included and the install.txt file... follow the install.txt file. I just fixed it so they should be the same now. The tinymce.module file I had included came from one of my sites where I'm using a custom TinyMCE theme.

Maniac8888’s picture

No problem and thanks for the info. Downloaded your new stuff. This is exactly what I was looking for; an easy way to insert images and have text wrapped automatically. Awesome!

venkat-rk’s picture

Sorry if I am asking the same question as the poster above, but I finally got down to installing and enabling this module, but must confess to still being confused.

I didn't have any trouble copying over the 'drupalimage' folder into the following path mentioned in INSTALL.txt:
\modules\tinymce\tinymce\jscripts\tiny_mce\plugins

INSTALL.txt then talks about enabling the drupalimage plugin and here is where my trouble starts. I am using 4.6 version of TinyMCE. So, should I edit the tinymce.module file as mentioned in INSTALL.txt?

Or, can I replace the existing tinymce.module with the one provided in the rewritten img_assist folder? I am assuming it contains the edited version of tinymce

Really sorry if this sounds like a dumb question.

benshell’s picture

That is correct. You can either edit the tinymce.module file yourself, or just use the one I've included (for Drupal 4.6.x only).

venkat-rk’s picture

Thanks, benshell.

vthirteen’s picture

i must have done some stupid mistake in installation but i cant understand where.

i use a tinyMCE 4.6.0 and substituted the tinymce.module in the tinymce dir with the one provided in the img_assist.zip file.

tinymce is not displayed anymore and i have this message displayed at admin/settings/tinymce (in line, i mean it's an error message within the tinyMCE admin page):

"Could not find the TinyMCE engine installed at modules/img_assist/tinymce/. Please download TinyMCE, uncompress it and copy the folder into modules/img_assist."

---

i just tried to start all over again from scratch. now that error disappeared and tinymce works with the new tinymce.module provided with the rewritten img_assist module, but:

- if i click on the tree icon (insert/edit image), it seems like tinymce doesn't recognize the drupalimage plug-in (which i did copy in the correct folder).

- if i click on the camera icon (upload img), i have a 404 error in the windows that pops up

any help is appreciated :-)

benshell’s picture

TinyMCE should be installed in /modules/tinymce/ (not inside the img_assist directory).

vthirteen’s picture

since it found a tinymce.module file in that directory, fro some reason it was looking for the tinymce engine as well. deleting the file was enough to solve that problem.

venkat-rk’s picture

Could not find the TinyMCE engine installed at modules/img_assist/tinymce/. Please download TinyMCE, uncompress it and copy the folder into modules/img_assist.

Ah, you have to download and install the tinymce module from http://tinymce.moxiecode.com/. That is, you need both this module *and* the drupal tinymce module.

See the install.txt of img_assist for the correct path for installing this module.

vthirteen’s picture

thank you for previous replies, still have the following problem:

- if i click on the tree icon (insert/edit image), it seems like tinymce doesn't recognize the drupalimage plug-in (which i did copy in the correct folder).

- if i click on the camera icon (upload img), i have a 404 error in the windows that pops up

the rewritten img_assist folder is in the modules dir. the drupalimage folder is in modules/tinymce/tinymce/jscripts/tiny_mce/plugins.

boomer6’s picture

Did you previously have img_assist installed? I noticed that it was still loading the previous drupalimage plugin instead of the new one. I think, for some reason, that the .js file is cached and it is still trying to load the old page which is giving the 404 error. Try clearing your site cache or wait for it to clear and it should work!

tasman’s picture

First, thank you for a wonderul module and all your work. On its own img_assist work wonderfully but the minute I enable tinymce the problems start. When I click add image the pop up opens - If I click insert nothing happens and if try to upload i get the following error:

warning: Invalid argument supplied for foreach() in /home/esh0002/public_html/drupal/modules/image/image.module on line 329.

warning: Cannot modify header information - headers already sent by (output started at /home/esh0002/public_html/drupal/includes/common.inc:384) in /home/esh0002/public_html/drupal/includes/common.inc on line 192.

The title of the image remains in the gallery.

What I've done:
- I uploaded your tinymce module as specified replacing the original module
- I copied over the drupal image plugin into jsscripts/plugins directory
- I removed the tinymce module from img_assit folder.

What I have:

drupal 4.6.5 (could this be the problem?)
tny-mce 4.6
img_assist your realease.

I'm sorry if I have missed something that has already been posted. But I went over and over this thread and checked and still nothing. If I disable tnymce though img_assist works perfectly.

Any help / guidance would be greatly appreciated.

Zach Harkey’s picture

Where is the direct link to download the modified version of img_assist?

-zach
------------------------
harkey design

: z

ica’s picture

Could someone explain why Image.module and img_assist.module are seperate any benefits of doing it so? - from user/usage point of view.

also looking into the cvs. (4.7) that image.module is not one of the default, again is there any benefit of it?

-imho- image handling is not optional for most websites or cms's but essential part of it.

i would extent the necessity to a media.module, sections handling -image, video and sound combined to be step ahead from all other CMS' or CMF's or whatever you define in an opensource 'product'

Zach Harkey’s picture

imo image handling is not optional for most websites or cms's but essential part of it.

Seriously. We're used to it, but it has to be disheartening for a new user be able to create a 'book page'(!?) but not an 'image'. Seems like I've heard about native image support before, but like ica says, I don't see it in the cvs; or is that not how it works?

-zach
------------------------
harkey design

: z

benshell’s picture

Yeah, I agree. It seems like this gets discussed every few months on Drupal.org, but image handling still isn't built in. I think it's heading that way though. Image.module has become so simple (and featureless) that it's a good base for other imaging and media modules.

gtoddv’s picture

Thanks benshell! Finally a image inertion module that actually works! You are my god.

Kindest Regards,

gtoddv

benshell’s picture

I'm glad you like it! :)

likoma’s picture

I just submitted a feature request (I hope I did it in the right spot) that says:

As ejort mentions here, I'd love to have a checkbox that gave the option to "Delete original image" (the one that you're uploading) so I/Drupal user can just use the resized/resampled image.

Another commenter suggested, "Just resize before upload." which I know how to do, but most of my clients (Drupal users) don't know how to do and they're going to upload their 2 MB images from their digital cameras and wonder later why (1) their servers are full, (2) the images load slowly, (3) you get the idea.

Thanks,

- Bradley

benshell’s picture

Actually the correct place for this feature request would be the image.module page: http://drupal.org/project/image. The actual uploading and storage of the image is unrelated to either version of img_assist.

Also, I don't know if this feature request is possible... the original image is used everytime a new image "derivative" is made (just as thumbnail). However, keep in mind that the "original" is actually recompressed from the real "original", so it'll probably take less disk space.* Also, you may be able to limit the image upload filesize or dimension. Each of these were options at one point, so hopefully they still are.

* This was true the last time I checked. Personally, I'd rather it DIDN'T work this way. I'd like the keep the originals in the highest possible quality.

wellsy’s picture

From what I see here this module is being developed for 4.6? Is that correct?

Will it be possible to use this in 4.7 when it arrives?

wellsy
like someone else here said "always use a test site"
permit me to add "backup your database regularly"
orchidsonline.com.au

benshell’s picture

Yes, last time I checked it still worked with CVS so it will probably work with 4.7 without a problem. If it doesn't, I will fix it.

wellsy’s picture

I will follow this with great interest!
Need any help with testing?

wellsy
like someone else here said "always use a test site"
permit me to add "backup your database regularly"
orchidsonline.com.au

William Mead’s picture

Benshell, I really appreciate the work you are doing. As a designer, not a programmer, I am kinda at the whim of your efforts.

Adding a way to get images into posts easily is probably the biggest drawback of Drupal for me at this time. Sure I can use some code to get the images I have to show in posts, but that is a real pain.

What I would like is to have an image float left and to have text wrap around it nicely. I would also like all images to be 20% as wide as the column I am working with, and when you click on them, a full size picture of the image opens in its own window.

for a live example of what I am looking for, look here: http://main.greasyfur.com

Obviously I have to tweak this code for every picture. It also has the disadvantage of having the browser redraw the picture smaller, rather than GD.

I loaded your version of image assist, I was able to get the window with the thumbs to come up, but when I click "insert" nothing happens. Have I done something wrong or stupid? I also had big problems with the original image_assist, which I could not get to do what I wanted at all.

I am using drupal 4.6 on a server hosted by hostgator.

benshell’s picture

Thanks, I'm glad you like my work so far.

Let me see if I understand the image workflow you want:

1) You want the images to always float left, never right. My version of img_assist gives you a choice of left/right... but for your purposes would you like to see the choice removed?

2) You want the images to be 20% of the width of the "COLUMN YOU ARE WORKING WITH". Does that column width vary? Or can all img_assist thumbnails be setup to always use a specific width in pixels?

3) Are you using TinyMCE, a plain textarea, or something else? And are you using the "Add Image" link, or the drupalimage plugin for TinyMCE? I haven't had any problems using it with TinyMCE, the drupalimage plugin, and clean URLs, but I haven't thoroughly tested it with other configurations.

4) The link to the full-size image in a popup window is something I'd like too, so I will definitely add this to img_assist (hopefully soon, at least before Drupal 4.7).

William Mead’s picture

1. the choice is fine - I may not have gotten to the point with your version of img_assist to allow me to see that. As long as it can float so text wraps around it.

2. Yes - the column I am working with - visually, I like it when the images are all the same width. It doesnt have to be a percentage - I just found that easy to work with in the script that I have. I could just as easily specify the width in pixels. Generally, I like fixed width templates better than the ones that stretch with the page.

3. Yes I installed TinyMCE, and it works fine. I did use the add image link, and I did replace the TinyMCE module with your modified version. I am also using the drupal image pluggin, and clean urls. I am using firefox on mac osx. Dont have access to a pc at the moment tor try there. I may have messed something else up in my fussing with it all. I could take it all out and try again.

4. Cool, full size image in a pop up window will be great. I like how the audience can get a larger picture with out dealing with navigation, leaving the page, etc. Very user friendly design I think.

I have been poking around for this info, but have not come up with it yet - do you know when drupal 4.7 is slated for release?

Thanks again for your efforts.

michalska’s picture

Unfortunately, I am also encountering this problem - I can't get the drupal image camera to work, and if I click on the text link to insert an image, I get a window from which I can choose my image, but when I click "insert" nothing happens.
Any tips on how to get the drupalimage plugin working?

I am using drupal 4.6 hosted on a Windows Brinkster account (which I cannot reccomend).

Michal Ehrman
Boutique - Online Fashion Magazine
http://www.boutique.co.il

benshell’s picture

I don't know. It should work if you're using Drupal 4.6.3 and the version of tinymce.module that I included with this rewrite of img_assist. Is this is fresh Drupal install? Have you previously installed other versions of img_assist and/or TinyMCE (not that it should matter, I'm just wondering)? What happens when you click the drupalimage camera icon? The "Add Image" link doens't work with TinyMCE, but what if you turn off TinyMCE... does the "Add Image" link work then?

Anyway, these are just things to consider. I probably won't be of much help for the next couple weeks... I'm in college and have a couple final projects that are taking all my time.

gtoddv’s picture

Just a couple of requests.

1. Can the drop-down box be the list of image galleries instead of my images (and if configured taxonomy terms)?

2. Can we have a text box for configuring the padding for the text wrap?

Thanks again for some great work. This is the type of stuff that will really make drupal appeal to the greatest number of folks.

gtoddv

benshell’s picture

1. I'm a little confused... the drop-down box does show taxonomy terms (in addition to "my images" and "all images"). However, I will acknowledge one weakness here that I plan to fix ... the drop-down should only show taxonomy terms (galleries) that have images in them (no empty terms in the list). There should also be an option to put the number of images in a term in parenthesis: Term One (32 images), Term Two (11 images), Term Three (2 images), etc.

2. The padding can easily be set in the stylesheet. Is there a reason you'd like a textbox for this? I'd rather keep the form as simple as possible.

Zach Harkey’s picture

First of all, great work. I am so into this. My users are already thanking weeping in joy.

After some testing, the main item that keeps coming up is the upload form. The fact that it uses the main stylesheet but not the actual page template causes most of my layouts to get munged up. Also, the pop up window is just too small (and not resizable) to accomodate the entire image node creation form.

Tell me what you think of this idea: Instead of presenting the full create image node form in a small popup window, what if it presented a greatly simplified on the fly form that only had the absolute minimum:

1. Title
2. Description
3. Image upload button

If the user wants to specify Authoring information, Options, User comments, path aliases, Input Formats, Attachments, Menu OTF, etc. he can use the normal 'create image' option on the website, and don't forget he can always go back and make changes to the other fields later anyway. But otherwise the streamlined form should just use the defaults without presenting them.

For the image galleries I suggest a default img_assist gallery that all images are posted to at first (they can always be moved later). Maybe the user could even specify it in the img_assist settings?

-zach
------------------------
harkey design

: z

PurpleEdge’s picture

For the image galleries I suggest a default img_assist gallery that all images are posted to at first (they can always be moved later). Maybe the user could even specify it in the img_assist settings?

This would suit me if I could stipulate that a user can ONLY upload to a default folder that I specify for each user - eg /$UserID/

In my situation it is not appropriate for multiple users to see other user images.

Zach Harkey’s picture

I think the only way to do that is to bypass the image module altogether. Perhaps using the htmlarea method described here.

Also read:
Using Upload Image

How to have public and private image areas

-zach
------------------------
harkey design

: z

PurpleEdge’s picture

Thanks for the suggestion, however I have multiple users who manage their own images and I want them to only ever have access to their own images.

I haven't investigated this deeply yet, since Benshell is doing such a great job, but filtering images somehow might be a simple option for me?

benshell’s picture

If there were an option to use a default img_assist gallery that all images are posted to at first (as Zack suggested), you could always filter them by user ID. If I added that option, and also a option like this:

Browse images by:
[ ] My images
[ ] All images
[ ] Categories

Would that work for you? No promises, of course, but if you need this feature, probably a lot more people want a feature like this too.

PurpleEdge’s picture

I just need a means of allowing users to ONLY see their own images. Imagine Avatars, as an example, there is no way you would want all uploaded avatars to be accessible to all users. I want the same sort of restrictions to be enforceable for all images - don't really care what technique is used, but the option of viewing "All Images" - is NOT an option for my needs.

Thanks.

cparrish817’s picture

I love this idea. I've been trying to think how to make general pics available to all users but so they cold upload their own picture posts as well.

benshell’s picture

Thanks, I'm glad you (and your users) like it.

I agree with you about the upload form. I don't like how complex it is either. I'll get to work on that at some point. You're also welcome to get a head start on this if you want to.

However, I'm not sure whether or not to include a taxonomy drop-down. The way I've set up the workflow on my site is I made images "not published" by default. Users can upload pictures to whatever galleries they want, but the images won't actually show up in the galleries unless an admin publishes them. However, they will still show up inline in their post(s). Img_assist will display a photo that is unpublished. However, img_assist will not let others use an unpublished photo if they browse by "all images". It may not be the intend use of Drupal's "not published" option, but it does seem to work well. Plus, an admin can quickly publish a lot of photos using "administer/content", whereas I don't know of a way to quickly assign taxonomy terms to multiple nodes.

What do you think of this workflow? Let's keep this discussion going. There are different ways to do things so let's figure out what is easiest for most people.

Zach Harkey’s picture

That is incredibly interesting.

Experimenting.

-zach
------------------------
harkey design

: z

toddcortez’s picture

Have it working fine on one site, but on another site operating off the same code base I'm getting errors relating to not finding "node_revisions" table - I think this has to do with the fact that I was using the old version of img_assist on this site, but had not used it at all on the site that works. But neither site has a "node_revisions" table. Looking at the image_assist.module source, this appears to be related to legacy code, but I'm not quite sure what to do about it. Would really like to be using this, the integration with TinyMCE is so much better. Any suggestions would be greatly appreciated.

Also, is there a newer version of your module available for download?

Thanks,
T

bomarmonk’s picture

I'm trying out this new incarnation now... fed up with the old img_assist and looking for a solution. I also can't get HTML-area to work (xinha).

benshell’s picture

Well, now there's a newer version. The 'node_revisions' table is only in CVS, not Drupal 4.6. I based my version of img_assist off the CVS version of img_assist, and I didn't test these legacy functions with Drupal 4.6 (since I don't use them).

I replaced img_assist_load_images() and img_assist_load_image() with copies from the 4.6 version of the original img_assist. Hopefully this will fix the problem (and not cause any new problems for those using CVS.

toddcortez’s picture

Works great now! Just what I needed. Now if it only worked with AcidFree as well ;-)

Great work!

notabenem’s picture

Really...
Are there no plans to incorporate acidfree support into img_assist?

Matyas

benshell’s picture

I just made an update so that img_assist will work without clean URLs. No need to upgrade unless you need this.

Zach Harkey’s picture

As far as I see it, the ability to easily choose/upload images on the fly is the single most important feature lacking from Drupal (It's almost a dealbreaker).

I've been testing this version extensively and here are my thoughts, and notes from watching over the shoulders of 12 brand new users (a design class I teach) one at a time as they attempted to place an image (followed by a list of possible improvements). Note: I am not using Tiny HTML Area, but I am using Markdown.

Overall. I like the ability to generate a new sized image on the fly, but not if it comes at the expense of the defaults. My users are constantly breaking my layouts. The best thing about the image module is that the admin/theme designer can determine an appropriate thumbnail and preview size (exactly, to the pixel) for the layout/theme/node, but the user doesn't have to think about it. They just upload whatever sized original they want and the preview size fits perfectly. (I tell them as a rule, don't upload anything larger than 1000px wide or it'll take forever to upload, and that does the trick.)

The problem with the current implementation is that in most situations, the user is going to want to use the default sizes, and this makes it very hard because they have to manually enter it in every time. Which means they have to go look in their notes and see that it needs to be, for example, 465px wide for a perfect fit.

The problem is they don't do this. They either just leave the default values of 200 x whatever, (which are hard coded into the module so even if I change these values in the code so that it defaults to my preferred size, all my sites (30 or so in a multisite setup) inherit the same value and they all have different size constraints. Even if they do take the time to enter the appropriate value that I specified for the thumbnail for instance, instead of using the existing thumbnail, it creates a duplicate.

I have spent many hours considering the best way to handle these things and here is an detailed list. I realize some of these aren't exactly quick fixes and I'm trying to determine the best way to move forward myself, but nonetheless here's the list:

  1. The add image window should not create its own thumbnail if it can use the default thumbnail image module has already created (since it is mandatory anyway).
  2. Size should offer (either by dropdown or radio group) all of the image sizes that have been specified in the Image settings first, with the last choice being 'other'. If 'other' is selected, it could activate a previously disabled fieldset where the user can specify the width and height. (It's my opinion that the only time img_assist should generate an image is if this is selected. Otherwize it should use the existing versions. It's a unecessary to have so many derivatives of the same image. Some of my images have like 7 sizes.)
  3. The pre-selected default should be 'thumbnail' (or pref in img_assist settings). The 'other' fields should not be pre-filled in with any default values - like they are now with 200 x 200 - because there is no way to edit or specify these values.
  4. 'Align' should offer at least left, right and center(no-float), and these should be implemented through css classes (e.g. .image-left, etc.) located in the img_assist.css instead of the current method of inline styles. This would allow theme designers to specify additional styles for inline images (e.g. margins and padding on the floats, etc.)
  5. An alternative route would be to rename 'Align' to 'Layout' and let the user choose from a list of classes that are defined in the stylesheet.
  6. All Popup windows should(must) be resizeable (frames too).
  7. Do we have to use frames at all? I would love to get the whole thing in one page, and use fixed positioning for the header and a scrolling div for the thumbs or something. You've already reduced one frame it seems.
  8. Bonus feature: Provide the option for the image to be a link, and even provide options for the target. For example (very rough):

    When clicked, the image should:
    [x] Do nothing (not a link)
    [ ] Go to the image's standard node view (preview size)
    [ ] Open original in popup window
    [ ] Go to [http://___________________________]

I still haven't addressed the taxonomy/gallery situation, but I wanted to get these ideas out there. If it would be helpful, I am willing to comp up some static UI screenshots to fully flush out the flow. I would also love to help in any other way I can. I'm kind of confused about how this version is being developed. Is it officially been absorbed into the existing img_assist module? Is it in the CVS somewhere? If I make some modifications to the code, is there a place where I submit a patch?

-zach
------------------------
harkey design

: z

benshell’s picture

Wow, that's a big list.

  1. img_assist does not create its' own thumbnails for browsing images. It does, however, create its' own image for the "properties" page and it creates its' own image to display on a node.
  2. That could be done. However, I don't want to the properties page to get too complicated. I agree though that it's an absolute must to limit the size of images that a user can create. Users are breaking my layouts too.
  3. It's the preview image on the properties page that is set to 200x200. Personally, I like big thumbnails, but many people use little thumbnails so I wanted to make sure this preview image is a decent size. I don't want it to show up as 100x100 (or even less). That is why img_assist creates its' own image for this purpose.
  4. The display on the inline images is set in theme_img_assist_inline() so advanced users can always override the defaults. However, it wouldn't be a bad idea to include additional classes like .image-left, so I'll keep that in mind next time I make an update.
  5. Good idea, but this might be confusing for some users since Microsoft Word uses the term alignment. However, I have thought about other layout ideas... the thing is that I'm just not sure img_assist is the way to implement them. Img_assist is designed for inline images. If you wanted your images to show in their own column on the left, for example, why use img_assist?
  6. Interesting, the window is resizeable when launched from TinyMCE, but not from the Add Image link. I will fix that next update. However, to make the frames resizeable they'd have to have borders. I hate frame borders, so that's not an option IMO.
  7. Frames have a terrible reputation, but as long as you only have to scroll in one place, don't need ancient browser compatibility, and don't need to bookmark the page, I don't think they're necessary bad. Besides, in this situation the frames make Javascript much easier. You're welcome to remove the frames, but this would be a lot of work so it's something I'm definitely not doing.
  8. I agree that we need a way to turn images into links. Did did you intend for your example to be shown in the img_assist options (so it will affect all img_assist inline images) or an the img_assist popup window?

Lastly, my version of img_assist is completely unofficial, and it is not part of the CVS. I developed it for use on my sites, and I released it because Drupal has been behind in the area of inline images, so I'm trying to help it catch up. I will continue to develop and maintain this version of img_assist until one of the following happens:

  1. It gets merged with the official version of img_assist (and the result will work for my sites).
  2. Someone else takes over and releases it as a new module.
  3. I no longer need it (not likely to happen in the next couple years).
drupalguest’s picture

Where can I download your version to test? All I'm looking for is to wrap test with image. I've been trying upload, htmlarea, etc., so hopefully you have the solution. TIA

=====
Drupal hosting - Up to $70 off, use coupon: HOTPROMO

benshell’s picture

The link is in the first post. Here it is again:
http://www.benjaminshell.com/demo/img_assist.htm

drupalguest’s picture

Thanks! After reading through all the posts, I wasn't sure if the updates were being applied to your version, added to the other one mentioned or deposited to cvs.

=====
Drupal hosting - Up to $70 off, use coupon: HOTPROMO

Artem’s picture

Hi, I am very much interested in adding the image upload functionality to my site. At the moment I am looking at several solutions and not sure which one is the best to start with :)

Is it possible to see some screenshots to get the feeling of what's the proposed solution is like?

benshell’s picture

Yes, if you follow the link in the first post (to my site), you'll see a few screenshots.

Artem’s picture

Nice screenshots. In my turn I made a well-screenshotted and detailed tutorial on img_assist installation. On my home PC I integrated it with TyneMCE and it works just fine. I think I'll try HTMLArea (or whatever it is called nowadays) also. Then I'll create similar detailed installation tutorial on img_assist + TinyMCE (and/or HTMLArea :))

Johan A’s picture

This looks very nice. Well done!

An idea that you may want to look into i would love to see done, instead of popping up a new window which the user has to juggle, why not try putting it on the same page using a collapsible fieldset with an IFrame in it. Its not a too distant jump from what you already have now ...

benshell’s picture

That's possible. I think I prefer the popup window though because an iframe would be limited in size because of the fixed width of many websites. However, if you can neatly integrate this functionality into the existing system as an option, I'd be happy to add to the release. Otherwise though, I probably won't be able to free up time for this (unless one of my clients wants this too).

Zach Harkey’s picture

I think we really need an upload status indicator. It isn't uncommon for an image to take a full minute to upload and during this time there is no feedback to the user, who is likely to think the upload failed or their browser froze.

It doesn't have to be an accurate progress bar, just some kind of message that says, 'image uploading, please wait.' and maybe a small looping animation. It would also be cool if we could disable the submit button (gray it out).

I really think this is an important usability feature.

Now that I think about it, is this something that should be implemented in img_assist, or probably image/upload module, or maybe even Drupal core?

-zach
------------------------
harkey design

: z

SorcererXIII’s picture

Maybe this has already been done in the 4.7 version (which I have not downloaded), but in the 4.6 version doesn't seem to have user permissions or a good way to restrict img_assist by page type. I'd like to have it only available to "power" users and want to turn it off (for all users) for forums and comments.

benshell’s picture

That's true, there are no permissions in img_assist (neither my version or the original version). Do we need a separate permission for this? Or can we just rely on the image.module permission to create an image?

benshell’s picture

Another good (but difficult) idea, Zach. :-) I can see it working like this:
1) Make a new upload page for img_assist (instead of just calling the standard create image form).
2) When clicking Submit, use Javascript to (a) launch an status overlay using CSS, (b) write new HTML/CSS code to a placeholder on the upload page, or (c) launch a popup window with a status indicator. I think (c) would be the easiest.
3) The image would continue to upload, and then go to the next page. That page would have to check for and close the popup window (if the third method were used).

I'm all for this if someone wants to do it. :-) Otherwise, maybe I'll get around to it someday.

wellsy’s picture

I think a status indicator is an excellent idea which will reasure users on a slow connection that things are still underway.

A cancel option may also be good to bail on the upload if is taking forever.

wellsy

orchidsonline.com.au

kaare’s picture

Here's a one-line-patch to make the link-attribute work. It links to the image node if |link=1| or any other value. Using only |link| doesn't work. You might also use the $attributes['link'] as a url easily, that is, treat this attribute as an url-string not a boolean value. I.e: |link=http://some.url/|

--- img_assist.orig/img_assist.module   2005-11-04 18:33:04.000000000 +0100
+++ img_assist/img_assist.module        2005-11-24 20:14:00.000000000 +0100
@@ -632,7 +632,7 @@
        
        $output  = "<div class=\"inline\" style=\"float: {$attributes['align']}\">";
        if ($attributes['link']) {
-               $output .= l($link, $img_tag);
+               $output .= l($img_tag, "node/" . $node->nid, array(), NULL, NULL, FALSE, TRUE);
        } else {
                $output .= $img_tag;
        }
benshell’s picture

Thanks, I haven't tried it yet but it looks good.

michalska’s picture

Unfortunately, I am *also* encountering this problem - I can't get the drupal image camera to work, and if I enable the add image text link and then click on the text link to insert an image, I get a window from which I can choose my image, but when I click "insert" nothing happens.
Any tips on how to get the drupalimage plugin working?
Or how to get the text link working?

I am using drupal 4.6 hosted on a Windows Brinkster account (which I cannot recommend), not using clean urls.

Michal Ehrman
Boutique - Online Fashion Magazine
http://www.boutique.co.il

benshell’s picture

You've posted this question twice. Please see my reply to your previous post.

guardian’s picture

how difficult would it be to make it also compatible with images uploaded to a menalto G2 gallery ?

also, i found a rounding error: i uploaded image.jpg using this new img_assist module, changed nothing to the suggested view size (200x155) and got the following results:

original size = 1642 x 1276
img_assist preview size = 200 x 155
img_assist view size = 199 x 155

it would also be great to have a single file for the preview generated by the image module and the one generated by the img_assist module

regards,
thx for this wonderful module

benshell’s picture

1) I don't know... how are the images in a menalto G2 gallery saved as nodes? If not, it'd be extremely difficult to make this work.

2) I'll have to look into the rounding error. I wasn't aware of this.

3) Do you mean have it so img_assist does not create it's own image derivatives and only uses the predefined image sizes?

guardian’s picture

1) => some existing modules allow to insert G2 pictures into nodes, i'll try to checkout how they achieve this

3) => well i mean foo.img_assist_preview.jpg is used to display image previews when you are about to insert an image inside a node. why not use the preview generated by the image module itself. with lot of images, this would save space.

2roofs’s picture

I could write a short book about how incredible this aspect of things is (tools to make it easy easy easy for the "average end user" or "web site owner" or contributor to put text and graphics on the internet), but I'll try to refrain... Other than to say, as others have mentioned regarding the general topic, there probably isn't anything more central or basic when it comes to the "comfort level" of that "average end user." And, from what I've seen, img_assist (with the image.module) takes care of the graphics part of that equation in a way that should make it possible for even those nearer the "average end idiot" end of the spectrum (people like me), to be able to include images with near-zero knowledge (of anything) and one eye closed...

Exellent job!

I also want to say that this particular thread is one of the best I've come across on the Drupal site. I'm sure there are many more like it, but everyone who's contributed to it ought to know it's: A) an impressive display of intelligent collaboration (a nice mix of things from "experts" and "not so experts," and good all around input from all concerned); and B) one that I found particulary helpful.

For example, Artem's "Installation screenshots" and "no-brainer" instructions made it possible for me to get the whole thing downloaded, installed and, wonder of wonders, working in something like 15 minutes... Not only that, but after installing everything, something seemed not quite right. Mainly, I couldn't see/find the options to position images on the right or left. After another 15 minutes of wondering and looking more closely, I figured out I ought to download the newer version from the page linked in Benshell's initial post. Made that switch and presto! All fixed.

And here's what's "impressive" about all that: As mentioned, I'm new to Drupal, don't come close to understanding it yet (taxonomy, vocabularies, books, nodes, etc.), and while I get the concept of modules and have looked them over (a real candy store!), I hadn't dared mess with any of them. So, being a near-average end idiot, it's only natural that the first thing I'd try to figure out is how to make it easy for people to insert graphics into whatever text they'd be adding to whatever sites I'd put together with Drupal... Never mind site structure, linking, etc. (see taxonomy, etc. above), let's just jump in here and see about getting a photo into a "story!"

And - thanks to img_assist and this thread (and Artem's guide for those in a hurry) - it looked like it might be, and, more importantly, actually was, a snap. So thanks everybody! This has been a good day for at least one Drupal beginner that will make things a LOT easier from here on out, no doubt (now that I've got this module installation things down and all - "Piece of cake" ;).

Okay... Pardon the length. I must be excited. And for all that, I do have a question that pertains to the images.module galleries... While I understand the necessity of the galleries being there, how can I set things so they don't show up as part of the "visible" site? That is to say, is it possible to set galleries to "invisible" so their only purpose is to serve as a "background repository" for the images placed via img_assist and not as "content items"? (If that makes sense.)

Also, is it possible for people to edit an image (right or left placement, description, etc.) after it has been inserted? Is there a way to bring it's img_assist "file" back up to edit the same way a story can be editied or is it best/simplest to just delete the code from the "story" and "re-add" the image? (If that makes sense).

benshell’s picture

Thanks! I'm glad you found this thread (and my rewrite of img_assist) to be useful. It's posts like yours that encourage me to keep contributing to the Drupal community.

To answer your questions:
1) The way I handle "invisible" galleries is I change the default options for the "image" content type to "Not Published". To this (on Drupal 4.6.x) go to /admin/node/configure/types/image. Uncheck the box "Published". This way you can create images using img_assist and they will not show up in any galleries, taxonomy pages, etc., but they will still show up in my version of img_assist. However, if you want to publish some photos, you can always go to administer / content and publish certain images. Just check the boxes by them, and from the Update select box choose "Promote the selected posts", and then click Update.

2) You can bring the img_assist window back up to edit the image properties, but currently only with the TinyMCE plugin. If you're looking at the plain text img_assist tags, you can still edit them but there's currently no way to bring the img_assist window back up.

benshell’s picture

I made a small update today to my version of img_assist:

I also moved the float left/right CSS into the img_assist.css file, per an earlier suggestion. That required me to also set up img_assist.css to be referenced from every page (it wasn't this way before).

Second, I fixed a bug that was preventing the editing of existing img_assist tags with TinyMCE.

And finally, I added a "link" field to the img_assist form (which affected several javascript files including the drupalimage plugin for TinyMCE). The PHP code in theme_img_assist_inline() controls how the link string is used. Right now it's setup to link to the URL specified, if the link string uses a proper URL format. It links to the image node if the link string is anything else. And of course there is no link if the string is blank. More advanced functionality can be added later, but I wanted to get the basic linking functionality into the code now.

guardian’s picture

I faced a situation where a left-aligned 200x155 image was inserted at the beginning of a story, on the left.

The teaser text was so small that the image was also floating left to the title of the next story which totally broke the layout: it would have been better to have the title of the next article start below the image.

I guess this problem is due to the fact that DIVs do not stretch unlike table cells.

Also, when using the excerpt module, it would be great to be able to specify a smaller size for the display. More generally, it would be great to be able to display the same image multiple times with different sizes. As a consequence, you would have:

foo.img_assist_view_x1_y1.jpg
foo.img_assist_view_x2_y2.jpg

where x1,y1 are the dimensions when the node is read in full page and x2,y2 are the dimensions used when teaser is displayed

finally, having a link to the original image node like the original img_assist does would be great, but this will be resolved with the merging :)

kind regards,
g.

bomarmonk’s picture

I grabbed the latest version and used your version of the tinymce.module. I have the advanced theme working with the camera link and tinymce running fine.

The pop-up window works well, except for one thing. It doesn't close when inserting the image. I get an error:line 77, char 5, object doesn't support this property or method.

The url reported in the error is:
"www.mysite.com/drupal/modules/tinymce/tinymce/...../themes/advanced/inde..."

I assume the error is triggered when the pop-up tries to close.

Oh-- and I'm getting that aforementioned error using Internet Explorer 6 on a Windows Xp SP2 machine (if it matters).

Also, is it me, or is img_assist placing a border around each image?

Other than that, this is a great mod to the img_assit module. It seems to work better than the officially contributed version. Good job and thanks!

edrex’s picture

So, like many other drupal devs, I'm moving some sites to 4.7. I've come around to the rich text editor/image management phase of the deployment, and, lo and behold, img_assist is broken.

We desperately need a well-supported image manager. TinyMCE is the editor of choice, so there should be no gotchas when running them together. Moxiecode has a good one that is, or soon will be, integrated with drupal (authentication etc). ATM, I'm willing to pay $40 for something that works. Long term, though, let's get this problem solved!

Concerns:

  • This code should be in CVS.
  • Is this going to be merged with the original img_assist? The screenshots look nice, and there seems to be lots of positive feedback.
  • There is an effort to port the original img_assist to 4.7. If this is the new img_assist, then we should be porting it to 4.7.

Benjamin, Matt, what's the plan?

Respectfully,
Eric D

benshell’s picture

I completely agree with you. This code *should* be in CVS, it *should* be merged with the original version, and it *will* be ported to 4.7.

I don't know what Matt's plans are for 4.7, and I haven't talked to him lately about the possibility of merging the two... but I'm working on a 4.7 version of my rewrite. I hesitate to give a release date, but if you need a 4.7 version right away and are willing to contribute a little then this will take a higher priority. I could probably get the port done this week if I work on it. Email me if you're interested in sponsoring this development.

From my perspective, the problem with merging is making the big decisions: Who decides what the future version looks like? Who is going to maintain it? I don't know how I could "merge" the two... after all, I started with the original img_assist and completely rewrote it. Besides the same name and similar filter tags, the modules are completely different. A few big changes that come to mind are:
1) Images are referenced by the node ID instead of the file ID.
2) My version integrates much better with TinyMCE. This required extensive re-structuring of the code. It should also be possible to integrate my version of img_assist with other WYSIWYG editors.
3) Image derivatives are created for any size, whereas the original version doesn't create it's own derivations. It seems like not everyone likes how my version creates derivatives (even though I thought this was an essential feature), so perhaps an option can be added to stop it from creating derivatives.

As the "unofficial" img_assist developer I'm not in the position to make a decision regarding the merging of the two versions. However, I plan to continue working on img_assist as long as my version is needed.

Zach Harkey’s picture

Ben, the more I think about it the more I wonder if the filter tags are necessary at all. Personally, I would much prefer the straight html. Does TinyMCE demand filter tags or does it work fine with straight html? I don't think that the filter tags are that much easier to use, especially for users familiar with html who have to relearn the syntax for a filter.

I've found that that my users don't mind seeing or copying and pasting html, they just don't know how to write it. If Tiny can display(wysiwyg) straight html then in my view that covers all the users who can't abide seeing any html at all. Everyone else can use the html.

Dumping the filter tags in favor of straight html has the additional advantage of being independent of the img_assist module for display. It is also more forward flexible and future proof.

I interested in sponsoring these changes and several more. For instance, I really want the user to have the option of making the image a link, and to give them the choice to link to a) the full image node, b) any of the derivatives, including original, in a popup window c) an external url

This functionality is incredibly important and easy enough to do — I can work in the interface and markup/css — if the output is straight html instead of the limited [filter syntax].

A lot of the time I find myself using the img_assist module to choose or upload an image, just so I can pluck the node id number out of the filter tag and replace the output with:

<a href="/image/view/22/_original" rel="original">
<img src="/image/view/22/thumbnail" class="left" alt="" />
</a>

I have a javascript that makes any link with rel="original open in a new window, which incidentally resizes to fit the image.

But it would be so much easier if the img_assist module would output this html to begin with.

This is the kind of deluxe functionality my users want and it's what I need out of img_assist, and I'm willing to contribute as much time and money as I can to get it working.

Let me know what you think and if/when you could start.

-zach
------------------------
harkey design

: z

benshell’s picture

TinyMCE works only with HTML, actually. The drupalimage plugin converts the filter tags to HTML for TinyMCE, and back to filter tags before TinyMCE exits. As far as the TinyMCE is concerned straight HTML would be easier.

HOWEVER (there's always a catch, or two), there are additional data fields that are not part of HTML Only local images are allowed. tags. The NID, title, and description are joined together and put into the ALT or TITLE attribute when the drupalimage plugin converts a tag to HTML for TinyMCE.

I suppose the NID could be removed if you don't want the ability to edit existing images with img_assist.

And I suppose the title and description could be joined, but personally I like having them separate so that in the theme I can bold the title, add a colon, add a space, and add the description.

I also like to theme the title and description to show in a div below the image. If this were done in HTML without the filter, it would be a look more complicated than a simple filter tag. It would also be easier for people to mess up the code and break pages. With TinyMCE it'd be harder to realign and move images, because in the WYSIWYG view you could move the image but it wouldn't move the DIVs. Here is a comparison:

[img_assist|nid=809|title=PummelCo|desc=CD-ROM Design|link=node|align=right|width=250|height=231]
<div class="inline right"><a href="http://www.benjaminshell.com/pummelco"><span class="image img_assist_view"><img src="/image/view/809/thumbnail" width="?" height="?" alt="PummelCo: CD-ROM Design" title="PummelCo: CD-ROM Design" /></span></a><div class="caption" style="width: ?px;"><strong>PummelCo: </strong>CD-ROM Design</div></div>

Notice the question marks. If the size were hardcoded, and then you couldn't change the sitewide thumbnail size without messing up existing pages.

The only advantage I can see for using straight HTML is independence of img_assist. Other than that, I think everything you want can be added to the existing version of img_assist. I don't think it's worth changing the existing version to use HTML instead. It would cause the problems I described above and it would really limit theming.

tredgettdm’s picture

I am not sure if this is a related problem , but I can create page content using "full html" input format, and include an image using img_assist without problem and the image is visable

I then edit the page using tinyMCE and the image is no longer visable. Viewing the page as HTML the link ref has been changed

Img_Assist:
img src="?q=system/files&file=images/tree.jpg

tinyMCE:
src="/?=system/files&amp;file=images/tree.jpg"

inserting "/" at the start of the path, and replacing the ampersand with the HTML character entity "&amp;"

I am sure this is a problem with input format filtering. I have created a new input format,with all filters disbabled (as described in the release notes) but the problem persists.

How can I fix this ? Does anyone have an input format or configuration which works. Any help would be appreciated.

Thanks

Dave T

benshell’s picture

Are you using this rewritten version of img_assist? If you are using Only local images are allowed. tags as generated by the original img_assist they may be getting rewritten by TinyMCE. TinyMCE filters your code for tags, attributes, and URLs it doesn't understand. This is separate from the Drupal filter system. There are easy ways to add support to new tags and attributes, but I don't know how to disable URL checking.

The best solution is to start using img_assist filter tags [img_assist|nid=123|...]. If you use this version of img_assist you can't insert Only local images are allowed. tags. The upcoming 4.7 version will use Only local images are allowed. tags only for textareas that are not input format aware (e.g. are not processed by the Drupal filter system).

venkat-rk’s picture

Besides the same name and similar filter tags, the modules are completely different

Please correct me if I am wrong, but doesn't the official img_assist fail to provide any option for aligning images? And isn't this one big feature of your module?

venkat-rk’s picture

I am looking to install your img_assist and tinymce modules on a 4.6 site for the final time. Could you please clarify a few questions for me?
http://drupal.org/node/32506#comment-67077

img_assist does not create its' own thumbnails for browsing images. It does, however, create its' own image for the "properties" page and it creates its' own image to display on a node.

Is the image for the properties page a temporary one? Also, when you say, "this img_assist module creates its own image to display on a node", do you mean that it creates a separate one or just that it actually does it through the image module? If the former, aren't there two nodes of the same image to deal with?

I agree though that it's an absolute must to limit the size of images that a user can create. Users are breaking my layouts too.

Does the latest version of your module address this issue?

It's the preview image on the properties page that is set to 200x200.

In my image module settings, the thumbnails are 100x100. Should I leave this setting alone or should I change this to 200x200 to match your module?

It seems like not everyone likes how my version creates derivatives (even though I thought this was an essential feature), so perhaps an option can be added to stop it from creating derivatives.

Is this (different derivatives) still the case with the updated version of your module

Regarding the tinymce.module you provide, how close is it to the drupal tinymce.module and does it provide all the changes (not the version jumps from 4.6 to 4.7 etc, but the bug fixes, updates) of the official (drupal) module? I mean, it is quite unreasonable to expect you to provide constantly updated versions of the module.

benshell’s picture

Is the image for the properties page a temporary one? Also, when you say, "this img_assist module creates its own image to display on a node", do you mean that it creates a separate one or just that it actually does it through the image module? If the former, aren't there two nodes of the same image to deal with?

This version of img_assist does create it's own image derivatives, and they are not temporary (they could be, I just haven't written a cron hook to do it). However, this does not create a second node. Img_assist works with image.module to manage images.

I agree though that it's an absolute must to limit the size of images that a user can create. Users are breaking my layouts too. Does the latest version of your module address this issue?

No, not yet. However, I plan to start putting a lot of time into img_assist again to get it ready for 4.7.

It's the preview image on the properties page that is set to 200x200. In my image module settings, the thumbnails are 100x100. Should I leave this setting alone or should I change this to 200x200 to match your module?

This is why my module creates it's own derivative for the properties page... so you don't have to change your thumbnail size. You can keep your thumbnails as small as you like, but the image shown in the properties window should always be big enough to see because it's currently hardcoded to 200x200 (this is the outer boundar -- the aspect ratio is always kept).

Is this (different derivatives) still the case with the updated version of your module.

Yes, but there will be an option to turn this off for 4.7. In fact, it will probably be off by default.

Regarding the tinymce.module you provide, how close is it to the drupal tinymce.module and does it provide all the changes (not the version jumps from 4.6 to 4.7 etc, but the bug fixes, updates) of the official (drupal) module? I mean, it is quite unreasonable to expect you to provide constantly updated versions of the module.

The tinymce.module in my package is the same as the 4.6 version, but with all img_assist related code removed. The 4.7 version of img_assist will not require a special version of tinymce.

venkat-rk’s picture

Thank you, Benshell. That answers all my questions. Time now to implement:-)

morty-1’s picture

I have the same problems that some other users already posted. The module works fine, but not when I use TinyMCE. When I click on the camera icon a window with a 404 error opens. I am using TinyMCE 4.6.0 . I copied the tinymce.module from benshell. Do I have to change anything more? I could not find a file called "plugin_reg.php" I guess it was part of older versions from TinyMCE and not 4.6.0 ?!

benshell’s picture

Are you using clean URLs? It should work either way, but it may help to debug this.

What happens when you manually go either:
img_assist/tinymce OR
index.php?q=img_assist/tinymce (depending on whether you're using clean URLs). Do you get a 404? Or do you get a Javascript alert that says "tinyMCE object reference not found from popup"?

Are you sure everything is installed correctly in the right directories? TinyMCE should be installed like normal in modules/tinymce. The original tinymce.module file should be replaced with the tinymce.module file I included. There should not be a tinymce.module file in the img_assist directory.

BTW, plugin_reg.php is in the 4.7 version of TinyMCE, which does not yet work with img_assist.

morty-1’s picture

I am not using clean URLs.

When I manually go to:
index.php?q=img_assist/tinymce
I get a Javascript alert that says "tinyMCE object reference not found from popup". After I click "Ok" the window shows the pictures.

I replaced the tinymce.module with the tinymce.module you included and there is no tinymce.module anymore in the img_assist directory.

Thanks a lot for your help, I really would like to get this going!!

benshell’s picture

Is the drupalimage plugin installed in the right place?

Check for this file (and directory):
modules/tinymce/tinymce/jscripts/tiny_mce/plugins/drupalimage/editor_plugin.js

It wouldn't hurt to open up the file and make sure it's looking for 'index.php?q=img_assist/tinymce'. This should be in the first 50 lines or so.

morty-1’s picture

I atually found the mistake. I was using a URL without "www" and ".com", I changed that and now it works!
Should the popup window close after clicking "insert", because it does not?! I am using IE.
Thanks for the help!

bomarmonk’s picture

I had the same problem that I reported earlier in this thread: the pop-up window refuses to close on its own.

benshell’s picture

That doesn't make sense... if the Drupal base URL is set correctly you shouldn't need a www or a .com. I do most of my development and testing on //localhost, without either the www or .com. Could you clarify exactly what you did to fix this?

Also, I haven't figured out the popup window not closing problem. I can't seem to replicate it. Do either you or bomarmonk have a live testing server where I can take a look?

morty-1’s picture

That doesn't make sense... if the Drupal base URL is set correctly you shouldn't need a www or a .com. I do most of my development and testing on //localhost, without either the www or .com. Could you clarify exactly what you did to fix this?
Strange, I will try to figure that out.

Also, I haven't figured out the popup window not closing problem. I can't seem to replicate it. Do either you or bomarmonk have a live testing server where I can take a look?
I set up a testing version for you, I sent you the directions etc.. The popup window closes when I don't use TinyMce, but with TinyMce it does not work.

benshell’s picture

Thanks, that helped me figure it out... I don't have time to try my solution right now, but I'm sure this is it: you're using a newer version of Moxiecode TinyMCE, which changed tinyMCE.closeDialog() to tinyMCEPopup.close(). See the changelog here: http://tinymce.moxiecode.com/tinymce/changelog

This function is called twice from modules/img_assist/tinymce.js. I would think the call might actually be tinyMCE.close() instead of tinyMCEPopup.close(), because I didn't initialize tinyMCEPopup in img_assist, but the tinyMCE object may have initialized it. Try both and let me know.

I guess I'll have to start testing with a new version of TinyMCE!

bomarmonk’s picture

Fatal error: Call to undefined function: _img_assist_get_thumbnail() in /home/gov/mysite/WWW/drupal/modules/img_assist/img_assist.module on line 916.

Ah, this was due to the fact I was accessing a node that had been created using the previous version of img_assist. Changed the image with the new img_assist and the node no longer produces an error. Good.

One other thing I need to hunt down: when I install your version of img_assist it makes all of my links turn bold-- or in my theme, this means they are active. Also, I'm still getting a border around all images processed within node bodies.

I'll see if I can't get your fix to work for the closing of the pop-up window-- using the older version of tinymce though- tinymce 1.44, per the module instructions.

bomarmonk’s picture

I still have the same error message and the pop-up doesn't close. Darn. I'll poke around too: see if I find the answer.

bomarmonk’s picture

Upgraded to tinymce 2.01 and used the tinyMCEPopup.close () command. This worked! Now I just have to disable full-screen for tinymce in drupal (not compatible with 4.6 module, I believe). I also need to figure out why all images are getting borders and why the new img_assist tweaks the formatting of my Drupal theme's links. Odd. Any ideas.

##okay-- the problem is definitely caused by an interaction with my site's theme and the new img_assist's img_assist.css file. I'm not sure if it's a problem with the img_assist.css or if the img_assist.css has simply exposed a long hiddlen flaw in my theme? Any help?

###Another follow up: It's this lbit of css that's causing the issue

a {
  font-weight: bold;
}

I delete this from img_assist.css and all the bold links on my site return to normal. So, my question remains: is this a problem with img_assist.css or my theme? Also, I found the borders setting in img_assist.css. Would this be a good setting to include in the pop-up window?

novelite’s picture

A follow up to the follow up:

To specify a bold font weight for image assist links without affecting the CSS of your them, change this (around line 18 of img_assit.css):

a {
font-weight: bold;
}

to this (with the id used in the pop-up HTML):

#img_assist_upload a {
  font-weight: bold;
}

Thanks for the great work on this module.

morty-1’s picture

You have to replace "tinyMCE.closeDialog();" on line 79 and 85 "tinyMCEPopup.close()" in the file tinymce.js (modules/img_assist/tinymce.js). Now the popup closes after you press "Insert" or "Cancel".

Thank you!

bomarmonk’s picture

Right now it instructs users installing tinymce to use version 1.44. Once your img_assist module becomes more widely used, there will be problems with the pop-ups if people follow the install instructions "AS-IS"

benshell’s picture

Just an FYI, Matt Westgate (the original developer of img_assist) has handed maintenance of the official img_assist release over to me, so we will have one official version for 4.7.

Although I haven't had time to implement (for 4.6) many of the suggestions in this discussion, or fix some of the bugs, I am paying attention so hopefully I will be able to make 4.7 the best release we've seen. Details to come later.

venkat-rk’s picture

Congratulations, benshell. You've been so helpful and responsive that you deserve this. Wish you the very best.

This is a great gesture from Matt too. We all know how hard it is sometimes to let go.

scroogie’s picture

Please take an extra look at the points Zach Harkey gave in post http://drupal.org/node/32506#comment-66350, especially the ones about the default sizes, and the dropdown for the image size!
How can I specify the Taxonomy where the uploaded image shall go into?
Im looking forward to see great versions of img_assist in the future!

scroogie’s picture

Oh, i forgot, the htmlarea.module has a similar popup. It looks good, but their problem is that you dont see previews of all files, but only of the one you clicked.
http://scroogie.de/files/htmlarea_insert_image.png
I thought maybe you would be interested in it.

DaveNotik’s picture

Hi Ben:

Great news! I've been following this thread closely as I believe improved image support around Drupal is crucial.

I'm using image.module (CVS) and img_assist.module (CVS) with TinyMCE (CVS) on Drupal 4.7beta2, and I'm having issues where no images are shown in the img_assist popup even though I've added images.

So I'm installing your module as we speak. Is there anything newer than the December 9th one you have on your site? And is it compatible with Drupal 4.7beta2? Also, do I need to remove the tables from the previous img_assist?

Guess we'll find out on the latter 2. I'll post back with my results.

Thanks for your work and contributions!

--Dave

DaveNotik’s picture

Call to undefined function: form_radios()

So the build you have available on your website is not compatible with 4.7 and the new form API. Is there a more recent build I can test out and provide feedback on?

And I was able to leave the table from the previous img_assist intact, as your rewrite uses the same table and structure/

Thanks!

--Dave

benshell’s picture

I'm working on the 4.7 version, but it's not ready for testing yet (maybe 1-2 weeks). I will anounce when it's ready, and it will be in the img_assist CVS repository.

You are correct that the database table has not changed, and will not be changing for 4.7.

bomarmonk’s picture

When I use image assist to stick an image into the body of a flexinode, only the code shows up: [img_assist|nid=485|title=|desc=|link=|align=undefined|width=200|height=100]

Any way to fix this?

benshell’s picture

Can you insert other codes from other modules into these flexinodes? I don't how how flexinodes work, but I imagine they use the standard Drupal filter system.

bomarmonk’s picture

It just occured to me:

I am using a flexinode.tpl.php file to custom theme the flexinode, so maybe there is some code I need to wrap around the text area ($node->flexinode_47, for example)?

I'll poke around and see if I find any answers. I'll also test with a flexinode without custom theming to see if that does the trick-- then it will implicate the theme.

tbone@dirtyredcommie.com’s picture

My codes are showing up plain text: [img_assist|nid=35|title=test|desc=|link=|align=left|width=200|height=133]

I'm using 4.6.5, and I used the code from your site. I'm also using a phptemplate theme. Could this be related?

edit: No, it doesn't seem to work in any theme.

benshell’s picture

It looks like the img_assist filter isn't turned on. Go to administer/input formats and click configure for the input format you're using (Filtered HTML, Full HTML, etc). Check the box for Inline images and click Save.

tbone@dirtyredcommie.com’s picture

That did it. Thank you, sir.

Is it just me, or is Drupal's admin system a bit convoluted? I'm not sure I ever would have found that on my own.

Thank you for the work you're doing, by the way. It has drastically improved the usability of my site.

parisp’s picture

I had the same problem since i was using custom templates to customize the look of my flexinodes. Using simply the flexinode variables e.g. $node->flexinode_2 i was having the same problemas you. However after asking a few questins in #drupal-themes i found out that changing the code to check_output($node->flexinode_2) would pass the contents throught drupals filters and thus replce the img_assist tags with the html tag its supposed to output.

DaveNotik’s picture

Great -- looking forward and ready to test!

Thanks for your valuable work, Ben.

--
http://dave.notik.com

mcreature’s picture

Just looked in the cvs repository and does'nt look like the image module has been updated towards 4.7 as yet. Is any one working on a 4.7 revision?

Thanks for all your hard work with image_assist, sounds very promissing. I will test it out as soon as a 4.7 version is available.

bomarmonk’s picture

"...finally have form api working with image preview. chx - check it out :)" I think this means that the CVS version of image has been updated to work with 4.7.. I tested it with 4.7 beta 2, and sure enough, it seemed to work. I was having problems with images in flexinodes, however (but I don't even think the image module deals with images in flexinodes). Anyway, it seems like progress is happening in that direction

scroogie’s picture

Flexinode uses its own image implementation. Image.module works with 4.7b

gtoddv’s picture

Thanks for all your hard work and for being so responsive. It has been a pleasure following this thread and using the code.

You do great work!

jamespvg’s picture

benshell,

I was just wondering how things were going with the eagerly-awaited 4.7 version?

Thanks!

James

benshell’s picture

It's getting there... I was working on it quite a bit until mid-last week. Right now I have some high priority (paid) work I need to finish, so img_assist has to take the back burner for a few days.

1) I've got the 4.7 forms upgrade and the new interface changes done. It's inserting tags into plain textareas just fine.

2) I'm having a problem with TinyMCE. Maybe someone can help. When I click on the camera icon I get a 404 not found error (just like several people have had here). I think this must affect only newer versions of TinyMCE since I was running an old version before (RC2, I think). modules\tinymce\tinymce\jscripts\tiny_mce\plugins\drupalimage\editor_plugin.js is calling 'index.php?q=img_assist/tinymce' but this seems to be relative to the TinyMCE directory, not the Drupal site root. The Drupal TinyMCE module includes the base URL in the initialization of TinyMCE, so there's probably a way to access this from the drupalimage plugin, but I haven't figured it out yet. Anyone??? If not, maybe the Javascript can get the current URL and remove everything to the right (and including) 'modules'.

3) I don't have the filter processing changes done. Right now it will still generate it's own images, but just about everything else has been setup to work with either custom image sizes, standard image sizes, or both. Adding this to the filter processing won't be hard.

I can't keep you all waiting forever though, so I'm going to post what I have this Thursday night.

danielems’s picture

Benshell, I'm having a problem with your version of img_assist on a fresh install of:

- Drupal 4.6.5
- tinymce module 4.6.0
- tinymce 2.0.1

I have no images loaded (just in case the old img_assist was causing problems). The tinymce module is working correctly with the advanced theme. I am using the tinymce.module and the drupalimage plugin you include with img_assist. I am using clean urls.

When I hover over the camera icon the browser statusbar is empty, but hovering over any other icon shows the tinyMCE.execInstanceCommand() function.

When I click the camera icon a new window opens up (no toolbars, statusbar, etc) displaying a themed window saying "Page not found". The address of this window is /modules/tinymce/tinymce/jscripts/tiny_mce/themes/advanced/index.php?q=img_assist/add&editor=tinymce

When I check to logs at /admin I have a warning saying "img_assist/add not found"

Any idea how to correct this? I don't really know where to start.

Thanks - I'm eager to start using the new img_assist. It looks great.

benshell’s picture

1) That problem may be caused by the extra code for the original img_assist module that is actually in tinymce.module. It should work if you manually remove all img_assist related code from the tinymce.module. Or, you can replace the tinymce.module file with the one I've included in my zip file.

2) Did you use my version of the drupalimage plugin?

It's gotta be something like that because that url is not correct for my version of img_assist.

danielems’s picture

That did it. I must have been using a different version of the drupalimage plugin.

Thanks for the quick, helpful response!

venkat-rk’s picture

I am just about to install Benshell's module on a production site which has the same specs as yours - 4.6.5, TinyMCE 2.0.1 etc.

Was it just the drupalimage plugin or did you use the tinymce.module provided by benshell to solve the problem?

Thanks.

danielems’s picture

ramdak5000,

I used the drupalimage plugin AND the tinymce.module included with benshell's version of img_assist.

stoltoguzzi’s picture

where can I download this new rewrite img_assist?

kind regards
stoltoguzzi

benshell’s picture

There's a link in the first post (http://www.benjaminshell.com/demo/img_assist.htm).

stoltoguzzi’s picture

Thanks it is working now, but have a beginner question.

I would like to create a special node where I have on the left side a n image and then the text.

XXXXXXX TEXT.......................
XXXXXXX TEXT......................
XXXXXXX TEXT.....................
XXXXXXX TEXT.....................

using flexinode and img_assist should work?

kind regards
stoltoguzzi

morty-1’s picture

Yes, it works with img_assist.

sambojambo2’s picture

Hi Ben,
I'm really looking forward to getting your module working - sounds like just the job.

Just would like a little clarification on the installation process, on 2 points.

1. In installation.txt it states at the top under dependancies to use:

* Image Module version 4.6.2 or newer.

We're using drupal 4.6.5 and 'image' is not a core module. But the downloadable 'image module' is version 4.6.0 ? Am I looking in the wrong place for 4.6.2?

2. The other thing is when enabling the 'drupalimage plugin' for tinyMCE, the install.txt states:

FOR TINYMCE MODULE AFTER 4.6 (not including 4.6):

Edit the plugin_reg.php file in the tinymce module. Add
these lines:

I can't find a 'plugin_reg.php' do I just create it and paste the respective lines of code in and drop it into the modules/tinymce directory?

Thanks in advance - if I can get this working smoothly it's gonna be a life saver!

Sam

--
http://surfcore.co.uk

gte451f’s picture

I wanted to post that there seems to be problem with the rewrite img_assist module on IE for 4.6.5 or a problem with me!

Using Img_asssit W/O tinymce (I'll tackle that when I can get the Img_assist module working) and can upload and insert an image using the text link to img_assist on firefox only.

On IE 6 trying to load the img_assist window results in
http://campsulting.com/temp/IMG_Rewrite_IE.JPG

I'll stop playing the squeaky wheel if 4.6 isn't supported or I did the install wrong.

LAMP Stack
PHP 5.0.4

-jim

benshell’s picture

I think I know what was causing this. For some reason I never had a problem with IE with this, but I discovered it when I started using the Error Console in Firefox. There were a couple javascript calls to functions that didn't exist, so to fix it just add the following to textarea.js AND tinymce.js (in your img_assist folder):

function initHeader () {
}
function initThumbs() {
}
benshell’s picture

1. The image module for 4.6.0 is the one you want. I'm not sure why it says it needs 4.6.2, but as far as I know all 4.6.x modules are compatible with Drupal 4.6.5.

2. There are two sets of instructions for installing the drupalimage plugin for TinyMCE. The one you're confused by is only for Drupal 4.7, so just ignore it for Drupal 4.6.x.

sambojambo2’s picture

Thanks for that it's working sweet - maybe it would be a good idea to change that in the INSTALL.txt, it would be a bit less confusing?

So we now have got it working with the 'advanced' TinyMCE theme. But we what to keep it simple for our users - how do you get the 'attach image' button to appear with the 'simple' theme?

We tryied a few things within the tinyMCE.module but no joy - can you point us in the right direction?

Thanks

http://surfcore.co.uk

benshell’s picture

I'm making available the first beta version of the new img_assist module for Drupal 4.7 for those who'd like to help test it and improve it. There are features that aren't fully implemented yet, but the basic functionality seems to be working on the following:
* IE6 and Firefox 1.5
* Windows XP
* Drupal 4.7 Beta4
* Latest image.module from CVS
* Latest tinymce.module from CVS
* MoxieCode TinyMCE 2.0.1
* PHP 4 and PHP 5
* Apache 1.x and Apache 2

Some known limitations (All of which will be fixed as soon as possible -- although help is welcome):
* TinyMCE: img_assist code in the TinyMCE module is still interfering with my version of img_assist. Now that my version of img_assist will soon become the official version, I'll submit a patch to the TinyMCE project. Until then, there's a patched copy of tinymce.module in my distribution package.
* Drupalimage plugin: I can't figure out how to get access to the base url variable in the Javascript plugin file, so right now you have to manually edit a file and input your site's base url (details in install.txt).
* Drupalimage plugin: You can't edit an existing image. This will be fixed soon. It's probably not hard to fix.
* Linking: I haven't added a default link behavior to the options yet.
* Linking: The popup feature isn't implemented at all. Any ideas here? I figured I'd go through existing Drupal modules first to see if there's anything for popups that will work with this. If not, I may have to write another module. I think image popups should be a separate module from img_assist.
* Linking: The URL field doesn't always work right. Some debugging will be necessary to figure out why it doesn't always work.

Please try this preview version only if you're really anxious to try it... but don't plan on it working perfectly. I only listed the limitations that I know of and can think of at the moment, but I sure there are many more bugs to fix and features to finish.

When it is done it will go to the Drupal contributions repository. For now, you can download it from my website:
http://www.benjaminshell.com/demo/img_assist.htm

parisp’s picture

i am using your image assist module on my 4.6.5 setup with tinyMCE and works perfectly fine. thumbs up for the good work.

However i have a small problem.

when i do not insert a title for the image (which is optional) a blank line apears on the bottom of the image. Any ideas how to make it not display this blank line when there is no title?

the code which makes this line apear is

<div class="caption" style="width: 200px;"></div>
venkat-rk’s picture

In the css file for either image.module or your theme (not sure which), set the value to "display: none"

jamespvg’s picture

Hi benshell,

Thanks indeed for this -- it looks great.

Unforunately, I'm experiencing a problem. The image code is only inserted when I am on the super-user account (1). Otherwise, when I click 'Insert Image' on the final popup page, nothing happens...

Any ideas?

venkat-rk’s picture

Check whether your other roles have permissions enabled for adding images.

administer>>access control>>permissions>>image module.

jamespvg’s picture

Yep, all relevant user roles definitely have permission: they can upload files both directly through image.module and through img_assist -- it's just that the correct code is not inserted into the textarea.

wtgee’s picture

Hi, I got everything installed and working correctly (I think) but the images don't want to float to the right. If I just use the TinyMCE image thing then it will work correctly, but when I use the img_assist it will not.

I could have installed something wrong as I was a little confused as to what to do, but I ended up cleaning out everything and starting over, so it should be correct.

Thanks,
~Tyler

benshell’s picture

Sorry, I didn't document this at all. At the moment you have to define the "float: left" and "float: right" for the .right and .left classes in your theme's CSS file. I'll fix this on my next update so it works out-of-the-box.

veelo’s picture

I take it that you found out how to set the base URL? I can't find the document_base_url variable in editor_plugin.js that INSTALL.txt talks about.

UPDATE: Sorry, found it. After moving it is in modules/tinymce/tinymce/jscripts/tiny_mce/plugins/drupalimage/editor_plugin.js

Regards,
Bastiaan.

veelo’s picture

Hi,

when uploading an image, what does this message mean:

The selected file /html/Drupal_test/files could not be copied.

An image node is created nonetheless, and the image does get uploaded.

Thanks,
Bastiaan.

yched’s picture

See issue 45559. A patch is pending.

bryan kennedy’s picture

I like this and seems like it is on the road to being more useful.

I would suggest you try and come up with an alternative to the pull-down menu for the categories. This method of selection is not good accessible design since it requires mouse selection and can not easily be replicated with a text-browser or keyboard only input. It also currently doesn’t work for me. When I select my various categories the view of images does not refresh.

Is the option to input HTML code not img-assist filtered code still exist somewhere? In the old img-assist it was called "Image HTML template." I would still like to be able to configure the code that is wrapped around my images. This is pretty essential for this to be a useful module for my use.

Its good to see someone working on improving this essential aspect of Drupal. I hope we can just build off of the things that the current module does well.

benshell’s picture

If you're using a text-only browser, you probably shouldn't be working with image modules. Images are not text. If the drop-down menu doesn't work, that's another story. I'll have to look into that and make sure it does work on all modern browsers.

The option to output pure HTML code is not currently part of img_assist. This version of img_assist is basically an entirely new module, so that is why I wasn't able to build on most of the old img_assist functionality. This is an option that I'm considering putting back into img_assist, but I'm not yet sure how to best implement this. It's only necessary for non input filter enabled textareas, so it's not critical for most uses.

You can customize the code that is wrapped around your images by redefined theme_img_assist_inline() in your theme. This is how theming works in normal Drupal modules.

bryan kennedy’s picture

I would strongly disagree with you about the auto select pull-down list. I absolutely do want people with low/no vision or poor mousing abilities (no-keyboard) to be able to add images to my site. You can easily get around this problem by using a pulldown menu and a button to implement your selection. Its just better usability and broadens the group of people able to use your tool without limiting functionality.

Hmm...I see your point about the code going in the theme. I would be personally frustrated to use it this way, but can't come up with a coherent argument about why this should be an option in the module. Probably more personal preference than anything else.

Just to be clear...do you see your module completely replacing the current img_assist module? The current one would go away and yours would take over eventually? Just curious. Thanks for responding to my persnickety opinions.

benshell’s picture

Thanks for clarifying. I'll consider that as an option for future releases.

Yes, my version of the img_assist module will be replacing the current img_assist module very soon. I am now the official maintainer for img_assist, but I'm working hard to fix some bugs and finish some features before I commit my version to the repository.

simon rawson’s picture

Great work, I'm sure. But I've found it to be quite buggy.

Clicking the "insert" button does nothing. Similarly I cannot successfully create a new image node with the upload button.

benshell’s picture

Yes, it's buggy. It's a beta version. That's why it's here, and not in the Drupal repository yet.

If you can't create an image node with the upload button, you're probably using an outdated version of Drupal and/or image.module. This code has nothing to do with img_assist.

quicksketch’s picture

I had a hard time getting this module to work initially, and I finally discovered that my problem was a tinyMCE setting I had specified. If you set inline_styles = true, tinyMCE will try to replace the height and width tags of the placeholder image with style equivilents. While normally okay, this will break the img_assist cleanup routine and end up throwing a bunch of PHP errors caused by a divide by 0 error (since the height and width are both erased).

Great work on this program. It is much more verbose than the original img_assist and I'm glad you've put all this effort into it.

quicksketch’s picture

Backwards compatibility fix: in order to support nodes created with the old img_assist an additional function is needed: _img_assist_get_thumbnail(). Right now if you try to load a node with the old img_assist format, it'll choke the whole page with a nasty PHP error. Ben, could you add this function to the module to make the legacy code work? I added it in mine and it's working great now.

Here's the missing function from the old img_assist

/**
 * Attach the thumbnail metadata to the image object.
 *
 * Unfortunately we have to query the database since the thumbnail can be named
 * something entirely different from the original image.
 */
function _img_assist_get_thumbnail(&$image) {
  static $thumbs = array();

  if ($thumbs[$image->nid] === NULL) {
    $thumbpath = file_create_path(db_result(db_query("SELECT filepath FROM {files} WHERE nid = %d AND filename = 'thumbnail'", $image->nid)));
    // In the really old version of image.module thumbnail names were 'thumb_filename.ext'.
    if (!file_exists($thumbpath)) {
      $pos = strrpos($image->filepath, '/') + 1;
      $thumbpath = file_create_path(substr($image->filepath, 0, $pos) .'thumb_'. substr($image->filepath, $pos));
    }
    $img->thumbpath = is_file($thumbpath) && preg_match('|^'. variable_get('file_directory_path', 'files') .'\/'. variable_get('image_default_path', 'images'). '\/' .'|', $image->filepath) ? $thumbpath : $image->filepath;

    $dim = getimagesize($img->thumbpath, $info);
    $img->thumbwidth  = $dim[0];
    $img->thumbheight = $dim[1];
    $thumbs[$image->nid] = $img;
  }

  if ($thumbs[$image->nid]) {
    foreach($thumbs[$image->nid] as $key => $value) {
      $image->$key = $value;
    }
  }
}

Just paste it at the end of the new img_assist module (with the other legacy functions) and your site will be backwards-compatible.

benshell’s picture

Thanks, I added this code to the img_assist module.

benshell’s picture

I just uploaded another revision of img_assist to my site at http://www.benjaminshell.com/demo/img_assist.htm. I have fixed a LOT of bugs since the last 4.7 beta I posted. However, there are still some issues to fix. I don't have time to go into detail now, but just be aware that I still consider this a beta version.

I'm hoping to put this in the official Drupal repository soon. I'd appreciate a little more help testing first though. I want the current img_assist users (who haven't been following this thread) to get a good first impression of my rewritten version.

bryan kennedy’s picture

Hey Ben,

This seems to have ironed out some of the quirks for me so far. I have also come around and totally see your point about defining the code wraped around the image in the theme. This was actually pretty powerful for me and eliminated a bug that the old image_assist module had where variables (width,height) could only be used once.

Do you have an official place to submit bugs and patches yet? I am using the default blue marine theme and have the settings set to show the image assist add image logo and am still only getting a text link. Should this be working yet or is this a feature to come?

RayZ’s picture

First, we appreciate all of your hard work to improve such an important area of Drupal functionality. Thanks.

Just a suggestion regarding making a good first impression when it goes in the repository ... it's probably a good idea to make sure that it has all of the features of the old img_assist, just done better. It might be OK to skip a feature if you know that almost nobody uses it, or if there is an alternative to the feature that is always better.

I'm not sure the ability to insert raw HTML falls in that category. I'd just hate to see img_assist be the show stopper for someone to upgrade to 4.7 due to a missing essential (for them) feature.

One possibility might be to make the current cvs version available somewhere until the new version does cover all of the features. Just a thought.

bryan kennedy’s picture

agreed

RayZ’s picture

Ben, I have installed the latest 4.7 version from your site, along with the current cvs of drupal, and the image and tinyMCE modules, but I'm having trouble getting it to work. I replaced the tinymce.module with the one you included and installed the drupalimage plugin according to your instructions and enabled the button in the tinymce settings. I also set both Filtered HTML and Full HTML to include the image filter.

When I click the camera button in the tinymce editor I get the pop-up window where I can see and select my images. When I insert the picture, a placeholder box appears and I can resize it. But I can't ever see the image. Even after Preview or Submit the source of the page contains a tag like ...

<img width="640" height="425" border="0" align="left" class="mce_plugin_drupalimage" title="nid%3D5%7Ctitle%3D%7Cdesc%3D%7Clink%3Dnone" alt="nid%3D5%7Ctitle%3D%7Cdesc%3D%7Clink%3Dnone" src="/modules/tinymce/tinymce/jscripts/tiny_mce/themes/advanced/images/spacer.gif" />

Any hints?

benshell’s picture

It looks like the name attribute is getting stripped from the placeholder image tags. The drupalimage plugin looks for the name value (just before TinyMCE exits) and converts this tag to the img_assist filter syntax. Check to make sure you added these three lines to plugin_reg.php (in the TinyMCE folder):

$plugins['drupalimage'] = array();
$plugins['drupalimage']['theme_advanced_buttons1'] = array('drupalimage');
$plugins['drupalimage']['extended_valid_elements'] = array('img[class|src|border=0|alt|title|width|height|align|name]');

The last line is the important one for this problem. This adds 'name' to the list of attributes TinyMCE will accept for img tags.

If this doesn't solve the problem, please let me know. I can give you some more debugging ideas.

RayZ’s picture

OK, it's the last line ... in your latest version, both ...
img_assist47/img_assist/INSTALL.txt
... and ...
img_assist47/tinymce/drupalimage/README.txt
... say ...

$plugins['flash']['extended_valid_elements'] = array('img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|obj|param|embed]');

... instead of ...

$plugins['drupalimage']['extended_valid_elements'] = array('img[class|src|border=0|alt|title|width|height|align|name]');

I thought the 'flash' looked like a typo, but didn't look into it any further. Thanks, that fixed it.

benshell’s picture

Thanks for letting me know about the incorrect install instructions. I just fixed them. There were no other changes at this time so you don't need to upgrade.

Patrick Nelson’s picture

Hi benshell,

I tried the above solution too, but all I get now when I view the node is the following text appearing (actually as/in the body of the node, not in the code behind it).

[img_assist|/cms/nid=30|title=Rollers 2|desc=|link=none|align=left|width=100|height=73]

cms is the subdirectory that Drupal resides in.

Any ideas why this doesn't work?

benshell’s picture

Is the "inline images" filter turned on?

Also, the text "/cms/" that is between img_assist and nid=30 doesn't look familar. Any idea how that got in there?

Patrick Nelson’s picture

Ben,

Yes, the inline images filter is turned on - for all input types, just to be sure.

The text 'cms' is the subdirectory that I have Drupal installed in :)

benshell’s picture

Have you tried manually taking it out of the filter tag? I don't know how it got there in the first place. I often use Drupal in a subdirectory as well, but I've never seen it show up in the filter tag.

Patrick Nelson’s picture

Ben,

No I haven't, but I will - just as soon as you tell me how to do that! ;)

valou’s picture

Hello.

I'm using the cvs version of drupal.
I'm not using the img_assit cvs but the version img_assist47 rewritten by you.

When I create a image, i have an error:

The selected file /home/valerie/public_html/drupal4/files could not be copied.

But the image is created!!
And in the directory files, there is a directory images. In this directory, there are the image and the file named files (but it is not octet).

You can see the screenshot of my problem:

http://img20.imagevenue.com/img.php?loc=loc121&image=00e5b_plan_de_trava...

Can you help me?

Thank you.

benshell’s picture

That is a current bug in the image.module. You should get the same error when creating new image nodes without img_assist. I'm pretty sure it only affects you when you have additional image sizes defined in the image module settings.

arpad’s picture

When I enable img_assist and go to Create Content > Image or Admin > Settings, I get a completely blank screen. There isn't any undisplayed HTML either. Just completely blank screens. I've reloaded Drupal, image and img_assist and created a fresh database and get the same results. All the downloads are recent, like within the last week or so. image and img_assist were downloaded 2/7.

When I disable img_assist the two screens show up just fine and I can use both of them, Images end up in the images/temp directory when I do a Create Content > Image but I get an empty screen after I hit "Submit".

I'm running Mandrive 2006, Apache 2.0.54, PHP 5.0.4, MySql 4.1.12 and Drupal 4.5.7

benshell’s picture

If you're using Drupal 4.5.7, I'm not sure how you're using PHP 5. I didn't think they were compatible. Also, I don't think my version of img_assist will work with Drupal 4.5.x. I originally developed it on Drupal 4.6, and now I'm only using and supporting Drupal 4.7.

valou’s picture

I use drupal 4.7 and Php 5.1.1 .
Do they compatibles?

benshell’s picture

Yes, I'm currently using Drupal 4.7 and PHP 5.

coupet’s picture

Good to know!

Apache is bandwidth limited, PHP is CPU limited, and MySQL is memory limited.

arpad’s picture

I scrubbed the 4.5.7 and installed 4.7.0-beta4, got it working. Then I installed image and now the Admin > Modules page is completely blank.

I deleted the image directory in the modules directory and the Admin > Modules page was once more accessible.

arpad’s picture

and found the following:

[client 127.0.0.1] PHP Fatal error: Only variables can be passed by reference in /var/www/html/universal-glass/modules/ima
ge/image.module on line 730, referer: http://localhost/universal-glass/?q=admin

benshell’s picture

Looks like a problem with the image.module (which is unrelated to this discussion about img_assist.module). First make sure you have the latest CVS version of image.module, but if you're still having problems you should check the image.module project page.

jibrael’s picture

I want to change the html outputted by img_assist - specificly the spans outputted around the image - editing the theme_img_assist_inline fuction seems to do nothing, infact deleting img_assist.module, yet the same html is been rendered still results in the same html been outputted. Yet I can't find anything else that outputs <span class="caption" style="width:.... only the theme_img_assist_inline function?

Thanks

jibrael’s picture

Seems I just had to edit and resumbit the node? I cannot make heads or tails of this since it is stored in the node_revision table, body column as an img_assist tag, surely this means it is rerendered every pageview? Or did I just miss the plot all together?

Cheers

benshell’s picture

The Drupal filter system caches the content of pages it has processed (even if you turn page caching off). If you make a change to the way img_assist outputs HTML, you will have to clear the cache in the database for it to take immediate effect on your content. This behavior is important for performance reasons, but it is kind of a pain when you're working on modules like this. I have to leave the database editor open and empty the cache table very frequently.

BTW, you are correct about how to change the HTML output, but you might want to make a copy of the theme_img_assist_inline function and put it in your theme. Rename 'theme' to your theme name. For example, if you were using the chameleon theme you would name the function chameleon_img_assist_inline. This way you don't have to re-edit this function when you upgrade to newer versions of img_assist.

bryan kennedy’s picture

You can also download the devel module, which will allow you to clear the site cache from your navigation menu. Very useful for this task.

jibrael’s picture

This makes sense now :) thought I was going insane for a while there.

donalm’s picture

For your development database, you could re-create your cache table using MySQL's blackhole table type, which "accepts data but throws it away and does not store it. Retrievals always return an empty result."

The following code will create a cache table using the 'blackhole' engine. Note that this is only useful for developers!

-- 
-- Table structure for table `cache`
-- 

CREATE TABLE `cache` (
  `cid` varchar(255) NOT NULL default '',
  `data` longblob,
  `expire` int(11) NOT NULL default '0',
  `created` int(11) NOT NULL default '0',
  `headers` text,
  PRIMARY KEY  (`cid`),
  KEY `expire` (`expire`)
) ENGINE= BLACKHOLE DEFAULT CHARSET=utf8;
peterdd’s picture

Hello,

I'm very new to Drupal (testing),
but have worked with eZ publish (for corporation) and Mambo/Joomla (quick solution for my sport club).

On eZ publish there is an output independent format (xml) of xml-content fields.

http://ez.no/doc/ez_publish/technical_manual/3_6/reference/xml_tags#obje...

And you can additional relate other nodes/objects(e.g. images) with a node. for sanity checks like on an attempt to delete an image if it is used/referenced by another node this can be useful too.

http://ez.no/doc/ez_publish/technical_manual/3_6/concepts_and_basics/con...

Output can be in html or pdf or whatever format.

On Drupal I tried the pdfview on content with image included by img_assist(official current 4.6.0 version) and it doesn't work.

Another try with content that uses a table from the tablemanager.module doesn't work too. So pdfview must know all the formats that use other modules???

In Mambo/Joomla there is the mambot concept, where images (or other content that should be inline) are included in the textarea-fields as tags like {mosimage} while the references to the imagefiles(just relative filepaths to a global defined imagedir) and the params like alignment are saved in a database field.
This is done very simple in an unusual way, but if the user understood the concept it is ok, but lacks some cms features.

I believe image module and something like img_assist module should be added in a drupal distribution.

Further I full agree with Zachs comments especially the selection of fixed, predefined sizes for inline images, so editors/authors can't break the layout too easy. If you really want the ability to set the size then use the role system to give special roles the right to do so.

Just my 2 cents on this topic.

benshell’s picture

Interesting post. Thanks for your comments.

Here are my thoughts:

1. I don't have much experience with the internal workings of other CMS projects. However, I did look at several others for inspiration of the img_assist GUI.

2. I don't know why img_assist didn't work with pdfview. I'll have to try that. img_assist works like any other Drupal filter, so pdfview definitely should be using the Drupal filter system. If it is not, pdfview must be of very limited usefulness.

3. You mentioned using the official current 4.6 version of img_assist. Please be aware that the official 4.6 version, my 4.6 version, and my new 4.7 version (beta) are three very different modules. They are [mostly] compatible with each other (the filter tags are similar), but the features and the inner workings vary greatly.

4. I agree that the image.module should be in a Drupal distribution (maybe img_assist too). Most users are going to want some sort of image functionality, so why not make it built-in? This has been talked about a lot for the last couple years I've been following Drupal, so maybe it will happen eventually.

5. The selection of predefined sizes, including an admin controlled maximum size limit, is part of img_assist 4.7 beta.

peterdd’s picture

to 2.: pdfview module (all tests made with drupal 4.6.5) currently use the raw node-body for pdfgeneration of a node. I added the node_prepare()-call in pdfview so the filters(?) (e.g. for img_assist, smileys, tablemanager) are used now. Took code snippets from print friendly module. :-)

After that htmltables of tablemanager are rendered in pdf now (little buggy, currently no css for tables), the smileys-pictures of the smileys module are shown even in the table in the pdf.

But when using pdfview on a node with img_assist-parts then I get following errors:
warning: fopen(): URL file-access is disabled in the server configuration in /xxxxxserverpathxxxxx/modules/pdfview/html2fpdf/html2fpdf.php on line 860.

warning: fopen(http://xxxdomainxxx/de/system/files?file=images/xxx.thumbnail.jpg): failed to open stream: no suitable wrapper could be found in /xxxxpathxxxx/modules/pdfview/html2fpdf/html2fpdf.php on line 860.

Viewing a node as html has the full URLpath in the src-param of images of img_assist, while the smileys filter uses relative paths. The smileys are directly accessible by URL - no special access needed, while the content images should only be accessed by using the role system.
(no urlhacking, images stored in a directory outside of "htdocs")

darinm’s picture

Firstly, good work Ben,

When I add an image only the photo icon comes up in a shaded box indicating where the image is placed rather than the actual image. Is this normal in the TinyMCE textarea? How can this be fixed or what might be the problem.

The whole thing works well but would be better if I could see the actual photo in the text area of TinyMCE once I insert the image.

Cheers.

benshell’s picture

This is by design. It'd be possible to change this in the future though. I'll keep your suggestion in mind.

RayZ’s picture

I also would prefer to see the actual image rather than a placeholder.

creatorsdream’s picture

Yes, please do keep this in mind! It's really a weird experience NOT to see the image. I'm sure users not accustomed to the internet are going to get very confused as to why their image is not viewable.

BTW, Thank you for all the work you are putting into this very needed addition to drupal! If it wasn't for this module, I probably would have not gone any further in setting up drupal for my web sites... now I'm hooked!

JohnG-1’s picture

Even more than previewing the image, I would like to see the 'title' and 'description' text included in the editing window ... IMO this is quite important. I would like to see the picture too :)

Would it be difficult to implement as an admin config option perhaps?

drupalista’s picture

Hi, don´t know if this is a bug, but I see, that the img_assist.css file is loaded for anonymous users that can not upload anything. there is an

<link type="text/css" rel="stylesheet" href="modules/img_assist/img_assist.css" />

in the header of every page loaded. I don´t want this.

is the functionality of img_assist dependent of inlusion of the css file on every page, even when the img_assist function is not used? I understand well, if the css is loaded at the point, when user wants to add images, but why is it loaded all the time? And, most importantly: how to change that?

Thanks!

benshell’s picture

There is already an option to turn this off. It's in the img_assist settings and it's called "Include img_assist.css on all pages for styling inline images?". (If you've tried this and it doesn't work, please let me know).

The reason the css files are included on every page is for the styling of the inline images placed with img_asssist. Advanced users like yourself can turn this off and style the images in your theme.

drupalista’s picture

Advanced user- Jesus, I wish I was!!! ;)

I am using a taxonomy_block (http://drupal.org/node/15192), what seems to be a good thing for setting up a site easily. Problem is: in these blocks the Image code shows up, not the image itself.

I do NOT want to have the Image in the $sidebar code. I do not know, what exactly generates that sidebar. The main content shows up correctly with image rendered - yes, I checked the filter page, img_assist is enabled.

What do I have to do to get the img-code OUT of the taxonomy_block? I am using the PHPTemplate box_cleanslate on 4.6.5 Drupal

I read about a similar problem in this thread, but did not understand the answer...

THANK YOU!

Later: Ok, I checked the code of the taxonomy_block.module and I replace line 248:

 #    $block['content'] = $content;
 #     replace with:
        $block['content'] = check_output($content);

Now the picture shows up in the Block. Well, of course the picture is much too big to be shown in a block, so ist there any possibility to ignore the inline image code? I only want the text in the teaser....

THANK YOU Very much for your attention!

And one more: seems like that code also kills my linebreaks, so the Title is not separated anymore from the teaser *sigh*... Boys, am i the first guy who wants images in taxonomy_blocks??? Sorry, i go sleep now, it´s too much...

Of course, if there is any other way to do what taxonomy_block does, but wihout images, please let me know... Thanks!

OK, I could not sleep before solving this:

I used this code now to strip the img_assist inline code:

248   $img_assist_tag = '%\[img_assist.*\]%';
249   $block['content'] = preg_replace($img_assist_tag,'',$content,1);

seems to work without any side-effects, but maybe anyone could check this? Thanks! Also I think it is a real dirty way of doing this and there moght be some better way of integrating img_assist with other modules? A cookbook recipe would be nice here...

OK, ONE MORE:

As the above code eats up all the $content, it is better to get it in the while loop that gets the nodes. I use it now like this (around line 235 in taxonomy_block.module):


    ### identify img_assist tag!
    $img_assist_tag = '%\[img_assist.*\]%';
    
    while ($node = db_fetch_object($nodes)) {
       $x++;
       $content .= '<div id="taxonomy_block_'. $x .'" class="'. (substr(decbin($x), -1) ? 'flip' : 'flop') .'"><h2>'. l($node->title, 'node/'. $node->nid,  array('title'=>t('view all'))) .'</h2>';
       if($result->teaser) {
 
       # $content .= strip_tags(substr($node->body, 0, $result->teaser) . (strlen($node->body) > $result->teaser ? '...' : '')) .'</div>';
       ### GET OUT THAT IMG_ASSIST TAG!
        $node->body = preg_replace($img_assist_tag,'',$node->body,1);
        $content .= strip_tags(substr($node->body, 0, $result->teaser) . (strlen($node->body) > $result->teaser ? '...' : '')) .'</div>';
       }
       else {
         $content .= '</div>';
       }
    }


As i really do not know anything about drupal code structures, please anybody with knowledge check this and, if not usable or unclean, tell me, how this kind of thing should have been done.

Thanks again...

drupalista’s picture

Hi,

how can I get the img_assist_modul to make the inline images a link to a page with links to bigger versions of the pictures that were used in the article? You know, what I mean? It´s quite the usual "pop up image galerie" - is it possible with img_assist?

An alternative would be to have a link on just the bigger sized version of the picture with description - the link is not added automatically, so how can I get this link?

Thanks!

JohnG-1’s picture

Are you
(1) using img_assist (or image node) to upload the image files or
(2) are your images uploaded using upload.module (or attachment.module) and inserted into the node body using the inline.module?

If (1) it should be working automatically. You may have a problem with your installation of either img_assist.module or image.module

If (2) you need to upload files with the image.module (or the img_assist add new image functrion) in order to create the image nodes to link to.

Does that help?

benshell’s picture

Linking to the node, a popup image, or another URL is a feature in the latest 4.7 version of my img_assist rewrite. If you're not user #1 (administrator), you have to add a permission to access this and you may have to also enable this in the img_assist settings.

JohnG-1’s picture

sorry

JohnG-1’s picture

when drupalimage / img_assist is called from the tinyMCE toolbar in fullscreen window, the img_assist window loses communication with the parent and so cannot insert images into it.

I think this is a problem with img_assist rather than tinyMCE ?

apologies for the druplication (http://drupal.org/node/50439), but I submitted this as a bug report nearly a fortnight ago and have had no response.

Am I the only person having this problem or is it a bug?
Any information most welcome.

benshell’s picture

Are you using my rewritten version of img_assist (the version discussed in this forum thread)? My version does not have a "lost communication with the parent window" message. That was an error that was hard-coded into the original version of img_assist. In fact, the main reason I took on this project of rewriting the module was to get rid of that error that I was always getting.

I just tried my version with the fullscreen mode and it works. Let me know if you have any more problems.

JohnG-1’s picture

thanks for such a quick reply benshell - I switched over to your version to test this prob so I guess it's my cache or something ... I'll try again and let you know.

update: Yay! I got it working after some installation problems and yes you have fixed it! Nice one! The UI looks real nice too :)

I encountered 2 problems:

problem 1:
symptoms: using tinymce drupal img_assist button opens window onto drupal 'page not found'.

error logged as :
img_assist/tinymce not found.
/modules/tinymce/tinymce/jscripts/tiny_mce/themes/advanced/index.php?q=img_assist/tinymce

bug: in img_assist/INSTALL.txt : 
line 3 of patch for plugin_reg.php:
  - $plugins['flash']['extended_valid_elements'] = ...
  + $plugins['drupalimage']['extended_valid_elements'] = 

problem 2 :
symptoms: using non-tinymce 'add image' link opens window with crazy frames;
url= .../img_assist/textarea?textarea=edit[settings][access_pages]
- top frame can't see anything; H-scroll only.
url= ...img_assist/header/browse (appears OK when I open frame in new window, though of course form inputs don't function)
stylesheets: misc/drupal.css (OK) and /modules/codefilter/codefilter.css (?)
- lower frame is better but clumsy H-& V-scroll bars.
url= ...img_assist/thumbs/myimage. (appears OK when I open frame in new window)
stylesheets: misc/drupal.css (OK), /modules/codefilter/codefilter.css (?) and modules/event/event.css (?)
- window is not resizable so it's difficult to see what's there.

(no solution - I was only using it for bug-hunting the first prob.)

JohnG-1’s picture

problem 1:
symptoms: using tinymce drupal img_assist button opens window onto drupal 'page not found'.

error logged as :
img_assist/tinymce not found.
/modules/tinymce/tinymce/jscripts/tiny_mce/themes/advanced/index.php?q=img_assist/tinymce

I thought I had fixed this problem but it came back again. I've just spent several hours trying to figure out why, without really changing any code and now the error has stopped! So once again img_assist ala ben works like a dream.

But I am perplexed. Could it be something to do with the cache not clearing properly (I'm using Firefox here) - I'm definitely clearing the cache table (every 5 minutes!) and the browser cache ... or could it be an intermittant code error in either img_assist or tinyMCE? I am using a recently patched version of tinyMCE (http://drupal.org/node/42452) rather than the one bundled in ben's download ...

I'm sorry it's such a vague question, but has anyone else experienced this? Any insider knowlege on FF cache? ... any thoughts?

budda’s picture

The latest archive code from http://www.benjaminshell.com doesn't appear to work on HEAD, probably because of the removal of the setting. All urls are broken, rendering the system unusable.

--
More Drupal modules

poorhouse’s picture

Hi,

I think this is an issue with changes in CVS and the Image module, due to changes in the File table. There is a temporay patch for it at http://drupal.org/node/50889 that works for me in the mean time, but as the comments there say it doesn't do file versions properly.

RayZ’s picture

Ben, could you give us some idea of what remains to be done before you are ready to put this into CVS?

I would like to suggest that you create a completely new project (maybe "image_assist"), then put a note on the img_assist page saying that it is being replaced by this new image_assist for 4.7 and beyond, with a link to the new project. That way you could get it into CVS whenever you like (now?) and start with a fresh issue queue that's not polluted with all the stuff from the old code-base.

(It would also allow us to finally put this forum thread to rest :-)

benshell’s picture

March 13th -- That's the deadline I'm giving myself to commit this to the official CVS repository.

I think I will submit it as img_assist though. Prior to taking over as maintainer of img_assist I considered starting a new project, but now I'd be maintainer of both (even though I don't intend to support the original version).

Ultimately I'd like to see img_assist grow into something that could support other types of inline content, like polls, videos, audio clips, Flash movies, galleries of images, etc. If I ever get around to this I'll change the project name then.

Zach Harkey’s picture

Am I the only one who thinks we would be better off opening our own phpbb forum for this discussion?

I mean, I've been tracking this thread, but it's gotten to the point where I get a sick feeling when I see comments have been added because I don't have the energy to scroll.

What are our options here? This is starting to feel like one of those monolithic ad hoc email exchanges perpetuated by office people who don't know any better.

This can't be how smart people communicate.

--------

Ha, of course it would be my post that triggers the pager so at first glance I look like I'm nuts.

: z

benshell’s picture

Although I expected some interest in the img_assist work I was doing, I certainly didn't expect this thread to grow to over 200 posts! I guess inline images are really important to a lot of people.

Now that the thread is on two pages it is kind of annoying, but we'll be switching to the Drupal project pages soon. I intend to commit img_assist to the CVS repository on March 13th. It's really close right now -- I just have to fix a couple bugs and finish the feature to add images using HTML instead of filter tags.

jsloan’s picture

You are not the only one... Dana Blankenhorn blogs at ZDNet and used this thread as an example.
"But maybe they're really families. Sometimes they're dysfunctional families."
http://blogs.zdnet.com/open-source/?p=583

bomarmonk’s picture

Dana says that this "key function" doesn't work on anyone else's machine? On the contrary, benshell's updated image assist module is the only one I can get working with my installation of Drupal. It takes a bit of patching and tweaking (nothing beyond what Benshell has instructed me to do), and it works.

Besides, as a key function, there are other choices: fckeditor, HTMLarea/xinha, etc. In the end, I think the new maintainer of this module needs a little pat on the back. He is one of the reasons that the Drupal family is functional, long threads and all!

Oh, and if it isn't working after you follow all of the instructions, make sure that you have your pop-up blockers disabled!

JohnG-1’s picture

This bug was causing problems with my 'default' tinymce buttons, my symptoms were as follows:

  • return key inserts double paragraph breaks : <p><br />return key</p><p>&nbsp;</p><p>&nbsp;</p>
  • text formats (bold, italic, underline) don't apply to selected text
  • list formats don't apply to selected text, but they do collapse the paragraph breaks and 'flicker' for a moment
  • undo doesn't appear to work
  • code cleaner doesn't appear to work
  • search & replace stopped working (no pop-up window)

These buttons are working as usual: drupalimg_assist pop up (benshell's version), help popup, emoticons pop up, html popup,
fullscreen pop up, link and unlink buttons

the javascript console in Firefox was logging this error (quite frequently):

tinyMCE.switchClassSticky is not a function on line 178 of .../drupalimage/editor_plugin.js

Here is the *patched* whole 'parent' function with offending line (line 5 in the extract below) escaped :

function TinyMCE_drupalimage_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
	function getAttrib(elm, name) {
		return elm.getAttribute(name) ? elm.getAttribute(name) : "";
	}

// tinyMCE.switchClassSticky(editor_id + '_drupalimage', 'mceButtonNormal');  /* it seems this whole line should not be here! */

	if (node == null)
		return;

	do {
		// This code looks at the name of the image to see if the drupalimage button should be selected.
		// However, by default 'name' is not accepted by TinyMCE as a parameter for the img tag, so it must
		// be added using the initialization string.  As far as THIS code goes, it could look at 'className' 
		// instead, therefore avoiding this requirement, however the regular image button looks at the 
		// 'name' value to see if it starts with 'mce_'.  If it does, it considers it an internal image and 
		// does not highlight the regular image button.  If 'className' is used here instead, BOTH buttons
		// highlight when a drupalimage is selected.
		if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'name').indexOf('mce_plugin_drupalimage') == 0) {
			tinyMCE.switchClassSticky(editor_id + '_drupalimage', 'mceButtonSelected');
		}
	} while ((node = node.parentNode));

	return true;
}

Now the drupalimage button and the ordinary (default) buttons seem to be functioning as they should (better than ever in fact - nice one benshell!)

Let's hope I haven't broken something else .... :)

donalm’s picture

The interface was working properly and I was able to insert images from my galleries into the TinyMCE workspace.

When I preview or submit the node, the image does not appear, and no HTML is being generated. I figured something was going wrong with the filter. I checked the database node_revisions table and saw that the tag being saved was something like:
[img_assist|/nid=48|title=Awesome Image|....]
and so on.

On closer inspection, img_assist is looking for a tag like
[img_assist|nid=48|title=Awesome Image|....]
so it doesn't expect to find a backslash before the nid.

I added the following to line 1064 of img_assist.module:

  if(!isset($attributes['nid']) && isset($attributes['/nid'])) {
      $attributes['nid'] = $attributes['/nid'];
  }

The images now display as expected. I don't know where the extra backslash was coming from (any ideas?), but this hack fixes my problem for now.

I'm running Drupal 4.7 - I think my CVS is up-to-date. PHP 5.1 and MySQL 5. I'm using Ben's non-versioned im_assist distribution and I'm a Drupal noob.

jessZ’s picture

I have a problem in that tinymce consistently changes the HTML linking back to the image generated by the img_assist module to “../123” or “../.../123” instead of leaving intact the original html “node/123” whenever a page is opened for subsequent editing. (the image source reference does not get changed) This breaks the link back to the image source resulting in urls such as domain.org/123 instead of domain.org/node/123. Since i put the caption information in the original image uploade node it is important that these links work (not to mention i hate getting a log full of broken links)

Since img_assist works fine with tinymce off I assume this is a product of the tinmce editor changing the reference not a problem of img_assist. How can I make a comparable change in tinymce so that the source image links stay intact?

I prefer to use the html code not the filter tag because I like to edit the html for specific image placement/size and not change the general settings. I also find that the filters tag functions erratically based on tinymce editor settings and input format settings that are various for different users.
I am using Drupal 4.63, TinyMCE ($Revision: 1.21.2.8 $). Img_assist settings ($Revision: 1.43.2.9 $)
I am not ready to upgrade to 4.7 due to various other modules and legacy hacks so I need a version that is pretty stable in 4.6.

cmsproducer’s picture

Being aware that the implementation of this flavour of the img_assist module is not for the impatient, I attempted to implement the module, but stopped mid-way because it tends to interfere with the prevailing CSS on the pages (changes the font-weight on all the links regardless of the class or ID).

Also, I am running 4.65 and I was not sure if your reference to all versions after 4.6 not including 4.6 refers to 4.6x. I must say that if it works, it's a good feature that my users have been asking for and I am looking forward to implimenting it once I have enough down-time to make the specific code changes and follow thet steps to install this module.

-----
Web Development & Production Advice - http://www.cmsproducer.com

benshell’s picture

Sorry, the stylesheet for the 4.6 has some problems, as you've discovered. I think I've fixed all these issues for the 4.7 version AND I've added an option to turn the stylesheet off for everything but the img_assist popup.

zom’s picture

under 4.6
great! But problem when activating the "insert" button it seems doing nothing.
An idea to correct that ?

benshell’s picture

Yes, you are probably using a newer version of TinyMCE than I originally designed the 4.6 version to work with. There's a post earlier about this (I know, it may be hard to find in this thread!). If you go into tinymce.js (in the img_assist folder) I think you can just fix a line of code to make it work. Watch out for any side effects of this though. The way TinyMCE plugins work has completely changed in the newer versions. If you have any other problems with TinyMCE you might want to disable the drupalimage plugin and see if that's the problem.

I am no longer updating the 4.6 version of img_assist, but the 4.7 version (which I will be officially releasing tomorrow) will work ONLY with the latest TinyMCE.

JohnG-1’s picture

I for one am really sorry to hear that img assist 4.6 won't be going any further :(

So I'll take the opportunity to say a huge thank you, Ben, for all you have done with img_assist - you've done a superb job.

<huge> Thank you </huge>.

RayZ’s picture

Where? I couldn't find any evidence. Did I miss it? We are all looking forward to it, as you can tell from the 224! comments on this thread.

benshell’s picture

An official release is here at last! Sorry I'm a couple days late on my March 13th target date. I had to do a last minute rewrite of the drupalimage plugin when I realized I was using an older version of TinyMCE and their plugin format has changed in the newest version (2.0.4).

Please post all bug reports and feature requests to the img_assist project page: http://drupal.org/project/img_assist

If I haven't incorporated any of the features you've requested or fixed any of the bugs you've reported here on this forum, please repost them to the project page so I'll be sure to remember them.

Finally, thanks for all your support! This project, and this forum topic, have both grown bigger than I could have ever imagined!

wellsy’s picture

Bigger than Ben Hur this thread for sure.

It would be great to make a new announcement and officially end this thread....it is very hard to find the new comments on the second page.

When I can move my test site to 4.7 I will give this a major workout.

wellsy

orchidsonline.com.au

solipsist’s picture

I'm using 4.6.5. Benshell refered me to his rewrite of img_assist after I posted a feature request needing a way to disable the linking of some images.

I have close to 70 images so far all created with the old img_assist module, how is the legacy support working? I'd rather not have to replace all the old img_assist tags with new ones since it would be a royal pain.

Now what I need to do, and which isn't supported by the 4.6 version of this module, is to disable linking on some images, for usability reasons, but Ben said it shouldn't be that if you know some PHP and I've been messing with it since 2001.

I've organized my existing images using taxonomy vocab terms in multiple level hierarchies and it works great, does this work with this new rewrite as well?

Any serious bugs reported for the 4.6 version? I am trying to make up my mind whether to switch from the old img_assist to this one, trying to find out whether it's worth it.

I appreciate any feedback and advice.

--
Jakob Persson - blog
Leancept – Digital effect and innovation agency

Anonymous’s picture

Hi !
How could I directly link the image to the full node ?

What would be great, is to have an option (checkbox) to link it to the full node or to an offsite link :)

Oh by the way... my images won't show... The link seems to be correct but when I right click to display the image in my browser... FORBIDEN

I have set the CHMOD of the images folder to 754... nothing more :(

Could you also help me with that please ?

Thanks a lot for your help :)
take it easy :)

Matt

Anonymous’s picture

hi!

I'd like to know how I can remove the title "caption" under the image ?
I don't want the title to be displayed under the image ...
Thank you :)

JohnG-1’s picture

you used to be able to toggle an admin config to insert captions by default or not ... but now I can't find it in admin/settings/img_assist (ver 4.6). Am I just looking in the wrong place?

JohnG-1’s picture

if so, sounds more like a drupal node permissions thing than CHMOD ... ?

rickvug’s picture

Thank you for getting this out. I will bug test it soon...

-------------------------------------------------------------------
Rick Vugteveen |rickvug.com @rickvug on Twitter

BlinderBomber’s picture

So I got img_assist working perfectly, but one thing I would like to be able to do is have the images appear on my front page. The articles that appear there are simply grabbed via php, so it obviously skips the processing that img_assist and the other image modules do.

Is there an easy way to get my images to appear or am I out of luck?

benshell’s picture

Do you want the images by themselves to show on the front page, or do you want the images that are inserted into articles/stories/blogs to show WITH the articles on the home page?

If the first, you could have the images show up by setting image nodes to be promoted to the front page by default. If you want them to be displayed a little more elegantly, like in a vertical column down the side for example, you may need a custom module (although a module that would work for this may already exist -- there are a lot of modules out there.

If the second, this should happen automatically in the images are close enough to the top of your post(s) to be included in the teaser. If you want to set how much of your post will be included in the teaser put this code in your post:

<!--break-->

BTW, neither really have anything to do with img_assist, so you might get more information in a new forum post.

t4him’s picture

Hi Ben,
I just went through the routine. I downloaded 'your' zip file and it all works. I have a question though.
In the TinyMCE demo program the image icon brings up an image browser and an advanced tab, etc. Can The TinyMCE image editor be used just like in the TinyMCE demo without the addon you have?
Sorry if this sound like I don't understabd because I don't. I am not a programmer. A side note here -- I was using htmlarea, it has a great image loader utility, but the code is not compliant and the editor in general is not clean, almost bulkie. I like the image tool in htmlarea but I like TinymCE editor --

Thanks again for your excellent work with TinyMCE.

benshell’s picture

The image browser you're talking about (which can be seen in the TinyMCE demo) is completely different than the drupal plugin I've written. You can use that one (you'll have to read TinyMCE documentation for details), but it doesn't work with Drupal image nodes like img_assist does. When you upload pictures into Drupal as image nodes (through the image module or img_assist) you are creating assets that can be reused in many ways. Not only can the images be inserted into posts with img_assist, they can be shown in galleries, voted on, the description can be searched, etc.

t4him’s picture

Yes. I wen't to 'recent post' and there they where, Image Nodes. Great! I will do as you suggested. Maybe it's time to learn this thing inside out. I'll start digging through the Moxycode Manual.
Great job on this project, you have been persistant and prompt.

I can see you have a passion for this and I must say, this is a poweful asset to Drupal.

RayZ’s picture

Just a suggestion ... why don't we all file out of here respectfully and quietly and let this forum thread "Rest In Peace" now that this version of img_assist is in CVS.

We can use the issue queue for most things and create new forum topics for anything else.

radiofranky’s picture

i'm keep getting this error message

/index.php?q=img_assist/upload
Referrer http://www.recipeshared.com/index.php?q=img_assist/upload
Message move_uploaded_file(): Moved: '/var/tmp/phpghcbO8' to 'tmp/tmp_LymBAS' in /home/recipesh/public_html/includes/file.inc on line 238.

benshell’s picture

As I told you in a personal email, I maintain img_assist and not image module. The problems you are having relate to the image module. In any case, please submit bug reports to the appropriate project page (such as http://drupal.org/project/img_assist).

wowgoldusa’s picture

新浪娱乐讯 由日刊SPORTS和JES共同主办,文化观光部和SBS协办的第42届百想艺术大赏,2006年4月14日下午18:00(北京时间14日下午17:00),于韩国国立剧院隆重举行。wow gold 本届百想艺术大奖由申东叶、郑智英、尹贤真,wow gold 担任主持,SBS TV进行了2小时的现场直播。

radiofranky2006’s picture

Hi,
the popup window is framed and is not displaying curretly.. everytime i post I need to scroll down to see the rest of fields.. is there a way to change it?

Currently to add an image requires mininum 2 steps..

1st step is upload image as a node, then insert image.. this is quite difficult for most of web users.. expecially for beginners.

Is there anyway you can create a more user friendly input interface?

like 1) click drupimage icon a pop up window appears 2) click on upload the file tab, upload the file 3) alignment stuff(right, left, top, bottom, size, margin, and etc) 4) attach

by eliminating the first pop up window(post image node) would make a lot of ppls life easier.

Thanks very much for the great module!

cheers,

ufku’s picture

try this uploader for tinymce
http://drupal.org/node/78033

Anonymous’s picture

Forgive me if this is a dumb question, but has the teething problems been ironed out for v5.x?

I don't want to download this and try what's suggested if it's going to be unreliable.

Thanks,
Karl

NetWhiz’s picture

Will there be a 6.x version soon?