• image resize function (transperant)
    26 April, 2009

    Found a great function for image resize in php. It requires php >= 4.3.0.
    I found the source in http://www.akemapa.com/2008/07/10/php-gd-resize-transparent-image-png-gif/

    <? # # function resize($img, $w, $h, $newfilename) { #

    # //Check if GD extension is loaded # if (!extension_loaded(‘gd’) && !extension_loaded(‘gd2’)) { # trigger_error(“GD is not loaded”, E_USER_WARNING); # return false; # } #

    # //Get Image size info # $imgInfo = getimagesize($img); # switch ($imgInfo2) { # case 1: $im...

    more..

  • Simple use of CURL
    06 January, 2009

    Here is a very simple structure of how to use curl with post method –

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,‘http://example.com/target.php’);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST , 1);// setting up to use post method
    curl_setopt($ch, CURLOPT_POSTFIELDS, array(“fieldName1”=>“data1”,“fieldName2”=>“data2”));
    $content = curl_exec($ch);
    curl_close($ch);

  • Stop cron job from sending output email
    05 January, 2009

    I created a cron job which needs to run every 5 minutes. So it was sending me 12 emails per hour and my inbox got overwhelmed by email pretty soon. I had plesk control panel and plesk won’t let you leave email field empty so I started to look...

    more..

  • Create wildcard subdomain using plesk
    28 November, 2008

    Its a mystery to me, why it is so hard to create a wild card sub domain in plesk. Any way here is how it is done.

    First go to Domains>domain.com>Dns Settings
    Then go to “Add record” and add the following record

    Record type: “A”
    Domain Name: *.domain.com
    IP Address: ip address...

    more..

  • how to edit a file in linux (vi command help)
    28 November, 2008

    There are lots of help out there about how to edit a file in linux, how to use vi, vi command list. But what I failed to find is a simple article which will just tell me
    how to open a file using vi, go to edit mode and finally...

    more..

  • Store file in MySql using PHP
    14 June, 2008

    Here is a good article on how to store file in mysql using php

    Blobbing Data With PHP and MySQL

  • Email validation function with DNS check
    08 June, 2008

    This is a simple email address validation function. It can be used as a spam guard in the contact forms. It takes the email address and checks for DNS record of the domain name. So, from an email address like: sample@domain.com, it looks for DNS records against sample.com....

    more..

  • Extra line break in Dynamic text field (PHP and ActionScript)
    08 June, 2008

    There is an extra line break problem that we faced while retrieving value from a PHP script to Flash ActionScript. It seems like an extra new line is inserted after every line command. Like:

    Line 1

    Line 2

    Line 3

    To avoid this problem, variables should be parsed from the PHP script...

    more..

  • FTP client with PHP/HTML
    22 April, 2008

    Create your all ftp accounts in one place and never forget them. Also manage multiple FTP accounts and assign them to different users.

    We were facing a problem with FTP accounts. We try to control the FTP information that our clients provides us. We do not give...

    more..

  • Increase file upload size
    22 April, 2008

    To increase the file upload size of a site following variables need to be configured

    memory_limit 64M [PHP_INI_ALL]
    max_execution_time 600 [PHP_INI_ALL]
    post_max_size 16M [PHP_INI_SYSTEM|PHP_INI_PERDIR]
    upload_max_filesize 12M [PHP_INI_SYSTEM|PHP_INI_PERDIR]
    

    You can change them in php.ini or htaccess

    Now regarding these variables you will find in the php mannual which can be set where.
    Bellow I have included the...

    more..

« Older