RSS

Tag Archives: php

Make your pages load faster by combining and compressing javascript and css files

http://rakaz.nl/projects/combine/combine.phps

RewriteEngine On
RewriteBase /
RewriteRule ^css/(.*\.css) /combine.php?type=css&files=$1
RewriteRule ^javascript/(.*\.js) /combine.php?type=javascript&files=$1
Advertisements
 
2 Comments

Posted by on October 10, 2008 in Uncategorized

 

Tags:

Weblog Thumbnails

Html2image

Html2image can convert html to bmp, convert html to png and convert html to jpg.

Installation process

1. Download html2image tool
wget http://www.guangmingsoft.net/htmlsnapshot/html2image.i386.tar.gz

2. Extract html2image
tar xvzf html2image.i386.tar.gz
cd html2image
export LD_LIBRARY_PATH=./

3. Run Xvfb
Xvfb :1 -screen 0 640x480x24 -nolisten tcp -audit 4 -auth X1.cfg & export DISPLAY=:1

(virtual framebuffer X server xvfb provides an X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory.)

4. Convert html 2 image by below command
./html2image http://www.google.com a.jpg

Shell Script to access this tool from command line

#!/bin/bash

cd; cd /opt/html2image

ls

export LD_LIBRARY_PATH=./

#rm /tmp/.X1-lock

./Xvfb :1 -screen 0 1024x768x24 -nolisten tcp -audit 4 -auth X1.cfg & export DISPLAY=:1

./html2image $1 /home/siteroot/public_html/html2image/$2

echo “html 2 image Done!”

PHP script (html_2_image.php)

<?

exec(“export LD_LIBRARY_PATH=/opt/”); // if html2image folder in /opt folder

// here html_2_image is above shell script

exec(“/opt/html_2_image http://www.yahoo.com yahoo.png”, $result, $returnValue);

?>

Execute “html_2_image.php” with cron job, the result image will saved to “/home/siteroot /public_html/html2image/” folder.

 
3 Comments

Posted by on June 20, 2008 in Linux, php, resources

 

Tags: , , , ,

Capture webThumb by COM

<?php
$browser = new COM(“InternetExplorer.Application”);
$handle = $browser->HWND;

//bring it to front
$browser->Visible = true;

$browser->ToolBar = false;
$browser->MenuBar = false;
///$browser->Title = “sandeep”;

/*$browser->Height = “2024”;
$browser->Width = “768”;*/
//$browser->TitleChange = “sandeep verma”;
//echo $handle.” sandeep “;

$browser->Navigate(“https://sandeepverma.wordpress.com&#8221;);

/* Still working? */
while ($browser->Busy) {
com_message_pump(4000);
}
$im = imagegrabwindow($handle, 0);

//$browser->GoSearch();

$browser->Quit();
imagepng($im, “iethumb.png”);

?>

<img src=”iethumb” height=”369″ width=”512″ />

 
Leave a comment

Posted by on April 14, 2008 in Uncategorized

 

Tags:

Setting CronJobs

This is the pattern for cronjob setting on linux server:

Minute Hour Day-of-Month  Month-of-Year  Day-of-Week   Command

0 0 * * * D:/xampp/php -q D:/xampp/htdocs/dolfin/periodic/cmd.php
(every day)

*/10 * * * * D:/xampp/php -q D:/xampp/htdocs/dolfin/periodic/notifies.php
(every 10 mins)

* * * * * echo “This is an example of cron command”
(execute after every minute)

0 18 * * * sh /home/user1/take_backup
(take_backup at 6:00 PM every day)

10,30,50 9-18 * * 1-6 cp /home/user1/display
(every day from MON to SAT display execute every 20 mins from 9:00 AM to 6:00 PM)

 
Leave a comment

Posted by on March 20, 2008 in Uncategorized

 

Tags: , , , , ,

GetId3 in php

GetId3 is used for getting information about server files like file title, file size, file duration etc.

 
Leave a comment

Posted by on March 5, 2008 in Uncategorized

 

Tags: