Showing posts with label FPDF. Show all posts
Showing posts with label FPDF. Show all posts

Friday, June 6, 2014

send mail using codeigniter

Taste Your Words ... Judge tosses interrogatio...
Taste Your Words ... Judge tosses interrogation in fatal Brevard deputy shooting (Oct. 8, 2013) ...item 2.. 'Rapebait' Fraternity Email Causes Stir (Oct 09, 2013) -- Class stupid @ 'Phi Kappa Tau' ... (Photo credit: marsmet53)
Funny Internet Spam for eMail and Websites is ...
Funny Internet Spam for eMail and Websites is Spicy (Photo credit: epSos.de)
LIFE Magazine (September 27, 1923)  ...item 3....
LIFE Magazine (September 27, 1923) ...item 3.. Is life really fair? -- This is the calculus of unfairness. (October 9, 2011 / 11 Tishrei 5772) ...item 4.. Coping with homework insanity (Posted on Tuesday, 09.18.12) ... (Photo credit: marsmet541)
 
If you want send mail using codeigniter
 on loclahost then you can use the following code for this purpose.
 
 
 
 
 
 
 
 
 
function sendMail()
{
    $config = Array(
  'protocol' => 'smtp',
  'smtp_host' => 'ssl://smtp.googlemail.com',
  'smtp_port' => 465,
  'smtp_user' => 'xxx@gmail.com', // change it to yours
  'smtp_pass' => 'xxx', // change it to yours
  'mailtype' => 'html',
  'charset' => 'iso-8859-1',
  'wordwrap' => TRUE
);

        $message = '';
        $this->load->library('email', $config);
      $this->email->set_newline("\r\n");
      $this->email->from('xxx@gmail.com'); // change it to yours
      $this->email->to('xxx@gmail.com');// change it to yours
      $this->email->subject('Resume from asd for your Job posting');
      $this->email->message($message);
      if($this->email->send())
     {
      echo 'Email sent.';
     }
     else
    {
     show_error($this->email->print_debugger());
    }

}
Enhanced by Zemanta

Saturday, April 5, 2014

How to UPLOAD image in Database

  there is main problem
how can i upload image in databse there is two way for uploading image in database

1.image uploading using blob
2.image uploading using folder


1.image uploading using blob

in this method  you have to create two files first upload.php and second is upload1.php.
upload.php

<form method="post" enctype="multipart/form-data">

<table width="350" border="0" cellpadding="1" cellspacing="1" class="box">

<tr>

<td width="246">

<input type="hidden" name="MAX_FILE_SIZE" value="2000000">

<input name="userfile" type="file" id="userfile">

</td>

<td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>

</tr>

</table>

</form>





Upload1.php


<?php

if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)

{

$fileName = $_FILES['userfile']['name'];

$tmpName  = $_FILES['userfile']['tmp_name'];

$fileSize = $_FILES['userfile']['size'];

$fileType = $_FILES['userfile']['type'];

$fp      = fopen($tmpName, 'r');

$content = fread($fp, filesize($tmpName));

$content = addslashes($content);

fclose($fp);

if(!get_magic_quotes_gpc())

{

    $fileName = addslashes($fileName);

}

include 'library/config.php';

include 'library/opendb.php';

$query = "INSERT INTO upload (name, size, type, content ) ".

"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";

mysql_query($query) or die('Error, query failed');

include 'library/closedb.php';

echo "<br>File $fileName uploaded<br>";

}

?>

Saturday, March 8, 2014

pdf using php and fpdf

how can we generate a pdf using php and fpdf

What is FPDF?

FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.
FPDF has other advantages: high level functions. Here is a list of its main features:

1. download fpdf packeage .
2. pdfExample.php 


<?php
require('fpdf.php');

$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>


Header, footer, page break and image

<?php
require('fpdf.php');

class PDF extends FPDF
{
// Page header
function Header()
{
    // Logo
    $this->Image('logo.png',10,6,30);
    // Arial bold 15
    $this->SetFont('Arial','B',15);
    // Move to the right
    $this->Cell(80);
    // Title
    $this->Cell(30,10,'Title',1,0,'C');
    // Line break
    $this->Ln(20);
}

// Page footer
function Footer()
{
    // Position at 1.5 cm from bottom
    $this->SetY(-15);
    // Arial italic 8
    $this->SetFont('Arial','I',8);
    // Page number
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}

// Instanciation of inherited class
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
for($i=1;$i<=40;$i++)
    $pdf->Cell(0,10,'Printing line number '.$i,0,1);
$pdf->Output();
?>

 

Cell

Cell(float w [, float h [, string txt [, mixed border [, int ln [, string align [, boolean fill [, mixed link]]]]]]])


$pdf->Cell(20,10,'Title',1,1,'C');

SetFont

// Times regular 12
$pdf->SetFont('Times');
// Arial bold 14
$pdf->SetFont('Arial','B',14);
// Removes bold
$pdf->SetFont('');
// Times bold, italic and underlined 14
$pdf->SetFont('Times','BIU');

 

Family font. It can be either a name defined by AddFont() or one of the standard families (case insensitive):
  • Courier (fixed-width)
  • Helvetica or Arial (synonymous; sans serif)
  • Times (serif)
  • Symbol (symbolic)
  • ZapfDingbats (symbolic)
It is also possible to pass an empty string. In that case, the current family is kept.
style
Font style. Possible values are (case insensitive):
  • empty string: regular
  • B: bold
  • I: italic
  • U: underline

 


How to Host a Laravel Project on Hostinger’s hPanel: A Step-by-Step Guide

How to Host a Laravel Project on Hostinger’s hPanel: A Step-by-Step Guide If you're looking to host a Laravel project on Hostinger’s hPa...