PHP Imagick black background gif transparency

mars 8th, 2010

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);
}

PHPMailer : inline image seen as attachment

mars 5th, 2010

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);

Symfony : admin objets Propel arborescents

février 24th, 2010

Un excellent tuto, pour gérer des objets Propel arborescents avec admin sexy :

Merci à Tim !

Archos 405 Gen 5: hack and add UBS host female connector

février 5th, 2010

Archos Gen5 have USB host capability, but no way for me to pay 30 extra bucks to get it, and it’s still an extra accesory to carry along (Mac-like….).

So, I just follow this cable extension schematic, and solder inside 4 cable for the usb, and a 220kohms resistor. Then nicely dremeled and glued.

carkit1lex

usb_a_b_female

1 VCC Red +5 VDC
2 D- White Data -
3 D+ Green Data +
4 GND Black Ground

DSCF6586.resized

DSCF6587.resized

DSCF6590.resized

Source: http://forum.archosfans.com/viewtopic.php?f=19&t=4215&start=20

Mysql errno 150 / 121 / XYZ

février 3rd, 2010

You can get more explanation about last InnoDB error with this mysql command:

mysql> SHOW ENGINE INNODB STATUS;

Convert Pdf to Jpg

janvier 26th, 2010

convert -units PixelsPerInch -density 300×300 -quality 100 source.pdf destination.jpg

Vmware server Ubuntu 9.10 64bits : grab / ungrab / mouse / keyboard issue

janvier 17th, 2010

The fix :

~/.mozilla/firefox/.default/extensions/VMwareVMRC@vmware.com/plugins/lib/wrapper-gtk24.sh
and add in the second line:
export VMWARE_USE_SHIPPED_GTK=yes

source

Afficher / masquer numéro de téléphone / SIP

janvier 4th, 2010

Pour activer ou désactiver l’affichage de votre numéro de téléphone chez les correspondants que vous appelez (donc votre numéro) :

  • *31# : cache votre numéro
  • #31# : affiche votre numéro

Convert files encoding

décembre 9th, 2009

Convert some files from a specific charset to another :

recode -v ISO-8859-1..UTF8 *.php

Compare Propel and Doctrine

décembre 2nd, 2009

A good overview about these 2 ORM is available here :

http://redotheweb.com/2008/07/08/comparing-propel-doctrine-and-sfpropelfinder/