TCPDF : html content and href link empty

If you get an issue with TCPDF and link inside html content, here is a little patch (apply it in tcpdf.php file) :

// get attributes
// patch
if ($dom[$key][‘value’]==’a’)
{
$element = str_replace(‘\\\”‘, ‘”‘, $element);
}

// en patch
preg_match_all(‘/([^=\s]*)=[“]?([^”]*)[“]?/’, $element, $attr_array, PREG_PATTERN_ORDER);
$dom[$key][‘attribute’] = array(); // reset attribute array
while (list($id, $name) = each($attr_array[1])) {
$dom[$key][‘attribute’][strtolower($name)] = $attr_array[2][$id];
}

Posted in Dev

PHP Imagick black background gif transparency

If you want to put a white background instead of black background, add this piece of code :

$path_parts = pathinfo($file);
if ($path_parts[‘extension’]==’gif’)
{
$img = imagecreatefromgif($file);
$imgr = imagecreatetruecolor($neww, $newh);
$bgc = imagecolorallocate ($imgr, 255, 255, 255);
imagefilledrectangle ($imgr, 0, 0, $neww, $newh, $bgc);

imagecopyresampled($imgr, $img, 0, 0, 0, 0, $neww, $newh, $pixw, $pixh);
}

Posted in Dev

PHPMailer : inline image seen as attachment

There is an issue with PHPMailer and AddEmbeddedImage method.

In some email client, you will get image as an attachment and not inline as expected.

To fix that, patch the class.phpmailer.php with following :

$disposition = $this->attachment[$i][6];
$cid         = $this->attachment[$i][7];

// patch
$path_parts = pathinfo($filename);
$extension = $path_parts[‘extension’];
// end patch

$mime[] = sprintf(“–%s%s”, $this->boundary[1], $this->LE);

// patch
//$mime[] = sprintf(“Content-Type: %s; name=\”%s\”%s”, $type, $name, $this->LE);
$mime[] = sprintf(“Content-Type: image/”.$extension.”;\n”);
// end patch
$mime[] = sprintf(“Content-Transfer-Encoding: %s%s”, $encoding, $this->LE);

if($disposition == “inline”)
$mime[] = sprintf(“Content-ID: <%s>%s”, $cid, $this->LE);

Posted in Dev

Telnet SSL

If you want to test a SSL connexion (like “telnet <host> 80”), you can use this command :

openssl s_client -connect <host_ssl>:443

Thanx to skanx !

Posted in Dev

Install new kernel on Sheevaplug

Follow these steps to install new kernel to your sheevaplug :

sudo modprobe ftdi_sio vendor=0x9e88 product=0x9e8f

dmesg (to get wich ttyUSB)

kermit -l /dev/ttyUSB1 -b 115200

> connect

> root / nosoup4u

> reboot

> [during UBoot, cancel boot with a key]

> follow instruction of one new kernel

If you need to reset your uboot environnement : http://www.plugcomputer.org/plugwiki/index.php/Factory_Default_u-Boot_Environment

Kernel with dm_crypt support : http://photon123.dyndns.org/sheeva/README-2.6.31-06466-g4c203e00

Mysql Migration Toolkit : UTF8 conversion issue

Mysql Migration Toolkit has an issue with varchar different from varchar(255) : it considers that it is not useful to force utf8 for these fields !

Here is a solution, found here :

Dans la fenêtre “Source Database”, activer le bouton “Advanced” et compléter le champ “Connection string” avec :
jdbc:jtds:sqlserver://server:1433/database;user=user;password=password;useUnicode=true;domain=

Dans la fenêtre “Target Database”, activer le bouton “Advanced” et compléter le champ “Connection string” avec :
jdbc:mysql://server:3306/?user=user&password=password&useServerPrepStmts=false&useUnicode=true

,en remplaçant bien sur “server” et “database” par leurs valeurs respectives.

Ensuite, ne pas modifier les options qui permettent de changer l’encodage des caractères : les valeurs par défaut font l’affaire. Et voilà !

Posted in Dev