jEdit Community - Resources for users of the jEdit Text Editor
Image dimensions when writing HTML
Submitted by setmajer on Saturday, 21 February, 2004 - 12:53
Another question regarding using jEdit as an HTML/PHP/ECMAScript/CSS editor:

One great time saver in BBEdit/HomeSite/HTMLKit/etc. is the ability to get the dimensions of an image from within the app. While this isn't really something I would expect as core functionality, I'm surprised I can't find a macro or plugin to do this.

Is this something that's not possible? Or have I just not dug far enough into BeanShell to figure out?

TIA
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Try this Beanshell macros
by Skalex on Fri, 24/12/2004 - 10:19
One year ago I wrote such BeanShell macros.
/**
* Insert_HTML_Image_Tag.bsh
*/

caret = textArea.getCaretPosition();

parent = new Frame();
fileDialog = new FileDialog(parent, "Please select image...");
// Uncomment following line to browse directory of current buffer
// fileDialog.setDirectory(editPane.getBuffer().getPath());
fileDialog.setVisible(true);

if (fileDialog.getFile() != null) {
   image = new ImageIcon(fileDialog.getDirectory() + fileDialog.getFile());
   width = image.getIconWidth();
   height = image.getIconHeight();
   if (width == -1 || height == -1) {
      Macros.message(view, "Selected file is not image!");
   } else {
      tag = "";
      textArea.setSelectedText(tag);
      textArea.setCaretPosition(caret + tag.length());
   }
}

--
Regards, Skalex.
Plugin
by fixedsys on Sun, 22/02/2004 - 09:09
Hi,

I'm working on a plugin for exact this feature.
But I have stress and will need a couple of weeks to finish it.

Lars
 
yay!
by Anonymous on Sun, 22/02/2004 - 17:45
's cool--if I really want it ASAP I should get off my lazy butt and figure it out, no?

I'll be looking for it--thanks for the heads-up!
 
Long time ago...
by fixedsys on Thu, 23/12/2004 - 17:26
I'm very sorry it took so long time. I was not able to continue work on the plugin for months.

But finally I finished a test version.

If you want to try it: http://www.moviecorner.de/imgtag/ImgTag.jar

This is my first complete project ever in Java so please give me some time when it comes to fix errors and include new features. I still have to learn a lot.

Feedback is very appreciated.

Lars
It's completely do-able, thou
by Brad Mace on Sun, 22/02/2004 - 04:10
It's completely do-able, though not completely trivial. I think it'd be easy enough to get the asset at the caret using the xml plugin, but you'd need to do a little digging around to know how to determine the sizes of various image formats.
 
thanks
by setmajer on Sun, 22/02/2004 - 08:03
So I'd have to read the file itself, then?

I imagine most of the userbase wouldn't have a problem, but it's sounding a bit hairy for my blood.

Thanks, though. I'll just put it on the back burner for the moment, and maybe dig into it when I'm feeling more ambitious. Smiling
User login
Browse archives
« October 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   100936
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300