0.3 released…

December 14, 2008

The 0.3 version of my addon has been released 🙂

It can be downloaded here: 0.3

You can read about my project here: Project Page

This addon has ImageMagick command line converter included in it which is used to resize the images.  The following formats of images are supported for resizing:

  • JPEG / JPG
  • PNG
  • TIFF
  • BMP
  • DPX
  • EXR
  • GIF
  • SVG

Here are the instructions to use this addon:

  1. Download the addon from here and save it to hardrive.
  2. Next install the addon into Thunderbird.
  3. You can then change the options of the addon to change the resolution of the image(optional step).0_2_options
  4. When you compose a new email with images as attachments, the following message will pop up:0_2_send_option1
  5. Select “YES” to have the images resized to the resolution selected in the addon options.

nsIProcess to the rescue

December 2, 2008

The goal for 0.3 release was to have all the other formats other than the JPEG and JPG(already working) to resize, I found a open source command line program called imageMagick that can do the resizing.

Now the mission is to ship the small program with the addon and get the images attached in the email to run through this command line program.

The resizing syntax for imageMagick is as follows:

convert.exe source.jpg -resize 600×600 target.jpg

Now to do the same using nsIProcess, I needed the path to the convert.exe program which I had placed inside the component folder of the addon, here is how I got the path:

var getPath = Components.classes[“@mozilla.org/file/directory_service;1”]
.getService(Components.interfaces.nsIProperties)
.get(“ProfD”, Components.interfaces.nsIFile);
getPath.append(“extensions”);
getPath.append(id);
getPath.append(“components”);
getPath.append(“convert.exe”);

var path = getPath.path;

Next before getting the nsILocalFile using this path, we must change all instances of slash \ to double slash \\. Very Important step, learnt it the hard way.

path = convertpath.replace(/\\/g,”\\\\”);

// create an nsILocalFile for the executable
var file = Components.classes[“@mozilla.org/file/local;1”]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(path);

// create an nsIProcess
var process = Components.classes[“@mozilla.org/process/util;1”]
.createInstance(Components.interfaces.nsIProcess);
process.init(file);

After this all I needed to do is call run the process with the appropriate arguments:

process.run(false, args, args.length);

The issue that was happeneing here was the paths. The source and destination images need to have the absolute filenames else the resizing does not work. That took me some time to get running, but I think now I have got it working. The complete code will be released soon in 0.3 await it, little more polishing is needed.

XPcom Lab..

November 23, 2008

An excellent job done by David through the lecture this week and this lab. Made the concept of XPcom as clear as it can be for someone just introduced to it.

The lecture made me realise why Mozilla has stressed on the use of Javascript and the BIG chunks of complex code that Javascripts shields us from. After this lecture I really appreciate the use of javascript.

My lab files can be found here: lab

0.2 released…

November 16, 2008

Last night I released the 0.2 version of my addon.

It can be downloaded here: 0.2

You can read about my project here: Project Page

Here are the instructions to use this addon:

  1. Download the addon from here and save it to hardrive.
  2. Next install the addon into Thunderbird.
  3. You can then change the options of the addon to change the resolution of the image(optional step).0_2_options
  4. When you compose a new email with an image as an attachment the following message will pop up:0_2_send_option1
  5. Select “YES” to have the image resized to the resolution selected in the addon options.

looking ahead to 0.3

November 12, 2008

Yesterday doing some research I found a great program that i think should help in my picture re-size extension. The software is open sourced under GPL and is named “imagemagick“, it accepts command line arguments to do anything with images.

So the next question that arose in my mind is whether I can ship a command line program with an extension and use it. I posted the question in the mozillazine forums here. The response was positive and I was redirected to a very helpful page on Mozilla development.

Now I need to see if it is possible to send the .exe with the extension and issue commands on it. Anyone done stuff like this???

0.2 outcomes

November 9, 2008

Building on the 0.1, I would like to now add the ability to detect all of the major picture formats as currently it only triggers on JPEG formats. Another fix would be that the 0.1 was not compressing the JPEGs due to some javascript errors. I am working on it and hope to get the issue solved in time for the 0.2 release. This will ensure that the addon would be functional for JPEG and JPG formats of images. Another feature I am looking at is to display the current file size for the image to the user.

Mozilla Extensions lab!

November 9, 2008

Fairly simple lab given that I already knew how to setup the environment for the addon. Pretty straight forward. For someone new to addon development, there is an extension which will make writing code for extension very easy, its called “Extension developer’s Extension” by Ted, can be found here(opens in new window). It will allow you to easily create or edit the various files to be included in the addon and then easily package the addon into a xpi with a click of a button.

My addon can be found on my wiki page: zghansar.

Mozilla code lab

November 7, 2008

Last week’s lab frustated me sooo much. To fill everyone in with what was happening, I made the changes in the source code in the file “tabbrowser.xml” but after compiling and running firefox, the changes wont have any affect. I was working was sshing into the college computer. After fighting with it for a week, I decided to step into CDOT and try it directly on the computer and see why the code change is not having an affect.

The reason is so embarassing 🙂 …

After compiling when I move into “obect directory/dist/bin” I was typing “firefox” which was starting an instance of the firefox installed on the system and not the newly compiled Minefield. All I had to do was run the command as “./firefox” and that started the minefield with the tab behaviour change.

Although the tabs were opening next to the active one, just like everyone else, the closing of the tabs is a problem, the issue is how the tabs are stored in the array, this needs to be modified.

The patch file is on my wiki page.

FSOSSed!!!

October 30, 2008

Such a vast contrast between the Mozilla developer days and FSOSS experience. Not that anything was wrong with Mozilla developer days but just the fact that it was so early in the semester that I was not familiar with the terminology of Open Source technology.

For most part of FSOSS I was attending the education track, this is because of my volunteer work I do outside for educational institutes and they require the use of Open Source products like Joomla, Moodle and now after FSOSS I added Drupal to my know-how. Drupal is a much smaller community than Mozilla but it has its own way of going about things (may I dare to say that the look of their bug handling system is better).

During FSOSS I really understood how important and awesome David Humphrey’s Open Source classes are, the length to which David Humphrey has gone to make us understand the methodology and the way Open source communities work. The real outcome of this course I feel will be after finishing this course, the way the students will continue inside the community.

Lastly I cant wait for the videos of FSOSS to be released. As everyone of us have missed more than we atteneded 🙂

contribution

October 22, 2008

So I was thinking hard what could I put as my contribution.

Finally I came up with the easiest but very important contribution in my opinion. Hoping for some peers to jump on it.

you think you can contribute ??? go ahead….

See you all at FSOSS