HOWTO

Drupal, Gallery2, FCKeditor and G2Image integration mini-HOWTO

This mini-HOWTO will guide you though the integration procedure for both Drupal and Gallery2, with assistance of FCKeditor and G2Image. If you hope to insert your photo album images into Drupal without a heavily embed style, this should be your cup of tea.

Why not integrate with Drupal's gallery.module?

The most simple answer should be: keep everything simple. I hope to keep my Drupal and Gallery2 installation isolated for a simpler management, as different system coming with different specific requirement. What I only hope to do is to reuse the existing resource coming from Gallery2, so user don't need to upload a single image twice.

Why not use Drupal's image.module + img_assist.module?

They are in different design so I use both solution. I use image.module + img_assist.module for tiny amount Drupal-only images, for fast layout design and so on, e.g. insert some image when writing a blog post as like as this mini-HOWTO. You won't hope to: 1. create a new album in Gallery2, 2. upload images and manage their title, 3. go back to Drupal and choice your image though FCKeditor, how fancy!

Demo Drupal and Gallery2 setup

In this HOWTO I will install Drupal and Gallery2 as path below:

www2:/# ls -la /var/www/
total 60
drwxr-xr-x 13 www-data www-data 4096 2009-11-07 12:49 .
drwxr-xr-x 18 root     root     4096 2009-05-29 09:13 ..
lrwxrwxrwx  1 www-data www-data   10 2009-11-07 12:49 content -> drupal-6.x
drwxr-xr-x  9 www-data www-data 4096 2009-07-02 04:55 drupal-6.13
drwxr-xr-x 10 www-data www-data 4096 2009-11-07 12:13 drupal-6.14
lrwxrwxrwx  1 www-data www-data   11 2009-10-27 14:40 drupal-6.x -> drupal-6.14
lrwxrwxrwx  1 www-data www-data   11 2009-11-07 12:49 gallery -> gallery-2.x
drwxr-xr-x 11 www-data www-data 4096 2009-11-06 16:01 gallery-2.3-developer
lrwxrwxrwx  1 www-data www-data   21 2009-10-30 09:14 gallery-2.x -> gallery-2.3-developer

Why a lot of symlink? Because whenever upgrade is required, I just need to download the new version and relocate the symlink target. No path or URL will be changed.

So if my server with URL http://example.com/ and Apache DocumentRoot on /var/www, Drupal and Gallery2 will be accessible though:

http://example.com/content/
http://example.com/gallery/

Moreover, Drupal's FCKeditor is already installed in:

/var/www/drupal-6.x/sites/all/modules/fckeditor

Where G2Image already installed in:

/var/www/drupal-6.x/sites/all/modules/fckeditor/plugins/g2image/

Download G2Image here, and also read its general installation guideline.

G2Image Drupal-specific configuration

Edit the /var/www/drupal-6.x/sites/all/modules/fckeditor/fckeditor.config.js, and add the following line:

FCKConfig.Plugins.Add( 'g2image' ) ;

I add the G2Image button to both DrupalFull and DrupalFiltered, so it should look like:

['Image','G2Image','Flash','Table','Rule','Smiley','SpecialChar','DrupalBreak'],

Now edit the /var/www/drupal-6.x/sites/all/modules/fckeditor/plugins/g2image/config.php as below:

$g2ic_gallery2_path = "/var/www/gallery-2.x/";
$g2ic_embedded_mode = TRUE;
$g2ic_use_full_path = TRUE;
$g2ic_gallery2_uri = '/gallery/main.php';

Ok that's all :D

Test the setup

Create a new node, activate the FCKeditor, and you should have something similar as below:
drupal_g2image-001.pngdrupal_g2image-001.png

When click on the G2Image button, you should able to browse your album, select and insert your images:
drupal_g2image-002.pngdrupal_g2image-002.png

Once insert your editor should look like:
drupal_g2image-003.pngdrupal_g2image-003.png

Ok so now save the node and review it. Enjoy :D


Koha on Debian Lenny + Squeeze mixed HOWTO

From Koha.org:

Koha is a full-featured open-source ILS. Developed initially in New Zealand by Katipo Communications Ltd and first deployed in January of 2000 for Horowhenua Library Trust, it is currently maintained by a team of software providers and library technology staff from around the globe.

This HOWTO will guide you though Koha 3.0.x installation on Debian Lenny + Squeeze mixed environment (Why in Debian mixed but not stable only? Well... This is my normal procedure with 3rd party tarball package...)


SNMP + RRDTool + Cacti on Debian Lenny mini-HOWTO

SNMP is used in network management systems to monitor network-attached devices for conditions that warrant administrative attention. With SNMP + RRDTool + Cacti, you can generate graph for your system dynamically. As compare with other solution, e.g. SNMP + MTRG, RRDTool is more specific for information NOT only about network traffic but support both other information, plus database-like query system so you can fetch report for any time period. This mini-HOWTO will guide you though the setup for SNMP + RRDTool + Cacti on Debian Lenny.


LDAP + Samba PDC + PAM/NSS on Debian Lenny HOWTO

Using LDAP is one of a good solution for single user database within networking hybrid system, e.g. integrate both user login for Windows and Linux, for email services, for web logon, and so on. This HOWTO will guide you though a basic system setup, including Samba PDC and PAM/NSS with LDAP on Debian Lenny. You can further more extend the use of LDAP to other system/platform with this setup.


eGroupware + LDAP on Debian lenny mini-HOWTO

NOTE! This is just my personal research progress log. Don't use it as production. If you are asking for some other update details, please refer to LDAP + Samba PDC + PAM/NSS on Debian Lenny HOWTO


VirtualBox 2.1.0 on Debian Lenny mini-HOWTO

VirtualBox is an x86 virtualization software package, originally created by German software company innotek, now developed by Sun Microsystems as part of its Sun xVM virtualization platform. This mini-HOWTO will guide you though VirtualBox 2.1.0 installation on Debian Lenny/sid.

As Sun Microsystem already release Virtual 2.1.2 with number of bug fixes, please refer to my upgrade procedure for more information.


LTSP on Ubuntu Intrepid mini-HOWTO

Linux Terminal Server Project (LTSP) is a free and open source add-on package for Linux that allows many people to simultaneously use the same computer (see Wikipedia). This mini-HOWTO will guide you though the installation and configuration procedure for deploy LTSP on Ubuntu Intrepid.

If browse though my blog you may found that I am a native Debian user, so why Ubuntu? Well, I try to fork similar setup within Debian Lenny, but found that using Ubuntu Intrepid is much more suitable:

  1. Ubuntu's LTSP is working with Network Block Device (NBD, see Wikipedia), where Debian still working with NFS. With this new handling client boot up time is boosted up in most cases.
  2. Ubuntu's LTSP boot image is working with SquashFS (see Wikipedia), where Debian's working with traditional format (well, sorry that I forget its format...). Moreover, Ununtu's LTSP boot image coming with additional benefit that you don't need to regenerate boot image every time after configure the lts.conf.
  3. Ubuntu's LTSP DHCP configuration file is pointed to /etc/ltsp/dhcpd.conf and DHCP server will ONLY use it for override /etc/dhcp/dhcpd.conf if there exists (check /etc/init.d/dhcp3-server for more information). In case of Debian you need to manually backup and configure your existing dhcpd.conf for LTSP.
  4. Ubuntu's LTSP + rDesktop run very smooth, where for Debian it become buggy. I try to compare their configuration files but can't figure out the reason...

Long story short: as Ubuntu coming with LTSP embed within their design, the support status are much handy and complete. IMHO, forget Debian in this case :S


Clone VirtualBox disk image on MS Windows mini-HOWTO

Since I am now testing VirtualBox performance, I need to clone existing guest image for multi-testing. This mini-HOWTO will guide you though the procedure for cloning a guest storage file for a new guest, under MS Windows host.

When following the official guideline and document, using VBoxManage clonehd command for disk clone, the result image is ALWAYS not functioning. Finally I figure out that a non-documented internal command is required: VBoxManage internalcommands sethduuid.

This bug is documented in VirtualBox bug ticket system #2813.

Within this artical, I am using the following system setup:

  • VirtualBox: v2.1.0
  • Host: MS Windows Vista Home Basic
  • Guest: Debian Lenny

Official procedure for cloning disk image (not function on MS Windows host)

Cloning an existing disk image for VirtualBox is much more than a simple copy command: it is because VirtualBox assigns a unique identity number (UUID) to each disk image, which also stored inside the image. VirtualBox will refuse to work with two image that use the same number. You need some extra handling.

According to official document, what you need is the console command VBoxManage clonehd, e.g. (host with MS Windows):

"C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe" clonehd hda.vdi hdb.vdi

or (host with Linux):

VBoxManage clonehd hda.vdi hdb.vdi

Therefore VirtualBox will copy your disk image, assign a new UUID for it, and import to its virtual media manager. You can now use it for your new guest system.

Alternative non-documented solution

As now you understand how the vboxmanage clonehd work around, what we needed is a new-and-unique UUID for our cloned disk image. There is a non-documented internal command which target for this procedure: VBoxManage.exe internalcommands sethduuid.

So what you needed for are:

  1. (Optional) Shutdown your target guest before disk clone.
  2. Manually copy the existing disk image, e.g.
    copy hda.vdi hdb.vdi
  3. Set a new UUID for the cloned disk, e.g.
    "C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe" internalcommands sethduuid hdb.vdi
  4. Manually add this newly cloned disk image though VirtualBox "Virtual Media Manager".
  5. Create a new guest profile as old system, and point the primary harddisk to your newly cloned disk image.


PostgreSQL 8.3 on Debian sid mini-HOWTO

This mini-HOWTO will guide you though the installation of PostgreSQL 8.3 on Debian sid. After install initial packages, you will need to create and configure both user account and database, which Debian installation script will not do for you.

Before start I will assume you have a complete installed and functional Debian sid box on hand. If you have no idea about this, please refer to my other article for more details.

This document is a refine and trim down version of my legacy artical which target for Debian etch. Most procedure are shared so you may also able to apply them in case of Debian etch.


Apache2.2 + PHP5.2 + pgsql/pdo_pgsql from sketch on Debian sid HOWTO

This simple HOWTO will guide you about how to setup Apache2.2 + PHP5.2 + pgsql/pdo_pgsql from sketch. Compile all package from tarball can give you the maximum flexibility of functionality, e.g. you can enable both mysql/mysqli/pgsql/oci8/pdo_mysql/pdo_pgsql/pdo_oci within single installation.

Before start, I will assume you have Debian sid and Postgresql8.3 installed correctly, which will not detail within this document. In case of Debian, Postgresql8.3 installation is just as simple as a single command:

apt-get install postgresql-8.3 postgresql-client-8.3 postgresql-contrib-8.3 postgresql-common

After installation, you should also initialize your user accounts and database. Please refer to my other article for more information.

This HOWTO is highly similar as my other article which target for install Apache2.2 + PHP5.2 + OCI8/PDO_OCI from sketch on Debian sid. Therefore some duplicated section will directly refer to there, and only mention those different in case for PostgreSQL in here.


Syndicate content