Author Archives: invtr

Image manipulation in PHP

To manipulate image (e.g. resize, rotate, flip etc) could be hard since it is not done everyday. It is required sometimes on certain project.

I found this library really easy and helpful. Just one file and can ease your life. Take a look.

zebra image

Update: Another one (open source) that looks easy to use. WideImage

How to easily create PHP image gallery

This becoming my favorite image gallery now – fotorama.io. So easy to implement with plenty of customization that we can do.

If you don’t believe how easy it is, copy following source code, paste and save as an html file. Then open it and see what will happen.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.css" rel="stylesheet">
<script src="http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.js"></script>

<div class="fotorama" data-width="100%" data-ratio="800/600" data-nav="thumbs" data-loop="true" data-allowfullscreen="true">
 <img src="http://s.fotorama.io/1.jpg">
 <img src="http://s.fotorama.io/2.jpg">
</div>

Alternatives:

http://photoswipe.com/

lightbox

Alternative to Adsense

Found a review about media.net (used by bing and yahoo). The rate is just bit below adsense but not that far compared to other ad networks.

Require one time account approval and need also approval everytime add new website to display ads

http://www.seobook.com/archives/000757.shtml

Also to study kiosked.com

Getting data from CI db query

1. All result set

$query = $this->db->query("YOUR QUERY");

if ($query->num_rows() > 0)
{
   foreach ($query->result() as $row)
   {
      echo $row->title;
      echo $row->name;
      echo $row->body;
   }
}

2. Just one row

$query = $this->db->query("YOUR QUERY");

if ($query->num_rows() > 0)
{
   $row = $query->row(); 

   echo $row->title;
   echo $row->name;
   echo $row->body;
}

Reference: CI2, CI3