Do you need a PHP programmer?
Use my services as a freelance PHP programmer by hiring me to do PHP programming on your website project.

I have built many custom PHP applications like project managers, classified ad websites and content management systems. I also work with open source applications such as WordPress, online shopping cart websites like Magento and develop content management systems like Joomla.

Monday, December 24, 2012

Jquery Image Slide on Hover

Hello,
In this post I will share  about  a simple jquery to animate an image when hovering. basically it is using jQuery’s animate() effect. I will use this effect to make transaction when hovering the image.
Let's looks the demo in the url below :
Jquery Image Slide

Ok, I begin with html code :

<div id="vertical" class="clear">
    <!-- Vertical -->
    <h2>jQuery image slide on hover effect (vertical)</h2>
    <div><a href="htmldrive.net"><img src="image-2.png" alt="" /></a></div>
    <div><a href="#"><img src="image-1.jpg" alt="" /></a></div>
</div>
<div id="horizontal" class="clear">
    <!-- Horizontal -->
    <h2>jQuery image slide on hover effect (horizontal)</h2>
    <div><a href="#"><img src="image-4.jpg" alt="" /></a></div>
    <div><a href="#"><img src="image-5.png" alt="" /></a></div>
</div>
<div id="easeOutBounce" class="clear">
    <!-- Horizontal -->
    <h2>jQuery image slide on hover effect (easeOutBounce)</h2>
    <div><a href="htmldrive.net"><img src="image-2.png" alt="" /></a></div>
    <div><a href="#"><img src="image-1.jpg" alt="" /></a></div>
</div>

We have 3 main div contain image links. each image has two face, maybe it will easier when you look image below :

image-1.jpg








  


image-2.jpg






Then defined simple jquery.imageslide.js to make it work, you can download full source Jquery Image Slide.

jquery.imageslide.js has 3 transaction type (vertical, horizontal,easeOutBounce) and you can use it with multiple images

Now you can set up the property of image slide as below:

<script type="text/javascript">
        $(document).ready(function(){
            $('#vertical div a').imgslide({
                width: 296,
                height: 130,
                animate : "vertical",
                duration : 300
            });
            $('#horizontal div a').imgslide({
                animate : "horizontal",
                duration : 300
            });
            $('#easeOutBounce div a').imgslide({
                animate : "easeOutBounce",
                duration : 800
            });
        });
    </script>

Run your code, it will work like a charm ^^.
That's all, hope it useful

Best regard,
Bayu Prawira

Add New Font for Dompdf

Hi Hallo,
In this post we will talk about PDF file conversion exactly DomPDF.
It allows direct conversion of HTML files to PDF files. But I found some issues when I was using this module, when I tried to generate pdf file, the result was not same as my html file. Some of fonts didn't apply in the pdf file. I goggled the web and found some solutions. And now I solved it.
I will share how to add your own font for dompdf,

1. For the simple step please go here DOMPDF web-base
2. Complete the form and upload your own font


  Make sure your dompdf version same with version in the form and Go

3. Download and extra the result (.zip). then Copy the contents of the result( .tff, .ufm) to your DOMPDF fonts folder (typically located at dompdf/lib/fonts).

4. If you have not previously installed fonts, you can rename the file dompdf_font_family_cache.sample(this file from the archive) to be dompdf_font_family_cache.dist.php (located at dompdf/lib/fonts). If you have previously installed fonts you will need to copy the relevant entry from the sample file into dompdf_font_family_cache.dist.php file.
Below is example for add some entry to dompdf_font_family_cache.dist.php


5.  Once you have taken these steps your font should be installed and ready to use.

Hope it can help, but if you still have any question
Please feel free to write your comment below.

Kind regard,
Bayu Prawira

Thursday, December 20, 2012

Get original size of image ( Jquery )

Hi buddy, Today I will share a short code to get original size of image on page that has been resized to fit in a div. It usually needed when you make photo gallery with thumbnail images. Ok, here we go, Lets look for the demo
 

Width: x Height:

 

Then look for the code, 
We will take the original size of image by using Jquery.  
Defined the jquery in your head container
 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Html code of image:

  <html>
     <head>
          // Defined Jquery
          <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

     </head>
     <body>
         <div id="myimg">
             <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLaXD9e5dDWD2dh5V-5pIegk_ipN2nZD9zp9miIYq_FQr_H-iy34uH5cPRDpHeKB2IbATqYv4j78uvqK4R50UZeeqexd1oU97SZ9b3SzpsqI2JS8z_twEqH9Snmjk2L3Kb_uk8N41l4iJg/s1600/nusa-dua.jpg" height="200" width="300" />
         </div>
     </body>
  </html> 

And below is the code to get original size of image:

$(document).ready(function(){
    var img = new Image();
    img.onload = function() {
        alert("width:"+this.width+" x Height:"+this.height;
    }
    img.src = $('#myimg img').attr('src');
});


Include get original size of image code in html:

  <html>
     <head>
          // Defined Jquery
          <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
          
          // Get original size code
          <script type="text/javascript">
               $(document).ready(function(){
                   var img = new Image();
                   img.onload = function() {
                       alert("width:"+this.width+" x Height:"+this.height;
                   }
                   img.src = $('#myimg img').attr('src');
               });
          </script>
     </head>
     <body>
         <div id="myimg">
             <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLaXD9e5dDWD2dh5V-5pIegk_ipN2nZD9zp9miIYq_FQr_H-iy34uH5cPRDpHeKB2IbATqYv4j78uvqK4R50UZeeqexd1oU97SZ9b3SzpsqI2JS8z_twEqH9Snmjk2L3Kb_uk8N41l4iJg/s1600/nusa-dua.jpg" height="200" width="300" />
         </div>
     </body>
  </html> 

Well done,
hope it will help,
Thank you for visit my blog,
If you have any question, just write comment below.

Best Regard,
Bayu Prawira

Wednesday, December 19, 2012

Make Label in Front / Top of Frame Visual Basic 6

Hi,
In this post I will share about label and frame issue in Visual Basic 6,
For newbie in VB6 (my experience), it sometime makes confuse
This is not too big problem, but it got stuck in my head before.

Ok, I will let you know the solution how to make label in front of frame
It is simple way but it works perfectly
just cut your label and paste in your frame







Well done,
Hope it useful, but if you have any question, just write a comment below.

Best regard,
Bayu Prawira

Tuesday, December 18, 2012

Credit Card Number for Tester

When make new program or system with payment method, programmers always need credit card number tester to test and make sure their program work well.

So the table below contains a number of credit card numbers that can be used to test credit card handling software. None of these numbers will work when trying to buy something (if you hadn't guessed).

Card Type Number
Master Card (16 Digits) 5105105105105100
Master Card (16 Digits) 5555555555554444
Visa (13 Digits) 4222222222222
Visa (16 Digits) 4111111111111111
Visa (16 Digits) 4012888888881881
American Express (15 Digits) 378282246310005
American Express (15 Digits) 371449635398431
Amex Corporate (15 Digits) 378734493671000
Dinners Club (14 Digits) 38520000023237
Dinners Club (14 Digits) 30569309025904
Discover (16 Digits) 6011111111111117
Discover (16 Digits) 6011000990139424
JCB (16 Digits) 3530111333300000
JCB (16 Digits) 3566002020360505

source : http://www.crazysquirrel.com/finance/test-cc.jspx

Best regard,
Bayu Prawira

Thursday, December 13, 2012

Simple Multiple Marker, Calculation Route, Custom Marker on Google Map

Hi Hallo, ,
Today I will share some code to make simple multiple marker on Google map. This code will show a google map in your web page with a place marker base on your locations. You can also custom the icon marker by yourself and active or inactive the calculation route.

Ok, You can see for the demo below:




So now, we start the code,
1. First we must define our code with google map api and jquery

<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>


2. Copy paste code below, make sure the code between <head>{your script}</head>

<script type="text/javascript">
 var map;
 var directionDisplay;
    var directionsService = new google.maps.DirectionsService();
 var global_markers = [];
// Represent your location here    
 var markers = [[-8.580467, 115.163001, 'My Home - Kekeran, Mengwi, Bali'],[-8.724085,115.180407,'Office - Simpang siur, Kuta, Bali']];

 var infowindow = new google.maps.InfoWindow({});

 function initialize() {
  directionsDisplay = new google.maps.DirectionsRenderer({suppressMarkers:true});
  geocoder = new google.maps.Geocoder();
  var latlng = new google.maps.LatLng(-8.580467, 115.163001);
  var myOptions = {
   zoom: 11,
   center: latlng,
   mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  directionsDisplay.setMap(map);
  
  // if you don't want to use  calculation route, inactive calcRoute() function
// and call addMarker() here 
calcRoute(); 
  }

 function addMarker() {
  for (var i = 0; i < markers.length; i++) {
   // obtain the attribues of each marker
   var lat = parseFloat(markers[i][0]);
   var lng = parseFloat(markers[i][1]);
   var trailhead_name = markers[i][2];

   var myLatlng = new google.maps.LatLng(lat, lng); 
   // customize the content buble here
   var contentString = "<html><body><div><h2>" + trailhead_name + "</h2></div></body></html>";
   // customize icon marker here
   var icon_img = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRmdVDVsRgbZXd4aoyhWNjP2px16J4nwpvLym4MrMLWEyzGBiTDRe_NDQHL5FU4QYJow0iN_WehzhIbReVMB6enMGtO1kb-xHTDEi83Rcp9RMh1k_Cb5SdqYoFQHCWYZBvrDpvB_Ta2l77/s1600/location.png";

   var marker = new google.maps.Marker({
    position: myLatlng,
    map: map,
    icon: icon_img,
    title: "Coordinates: " + lat + " , " + lng + " | Trailhead name: " + trailhead_name
   });

   marker['infowindow'] = contentString;

   global_markers[i] = marker;

   google.maps.event.addListener(global_markers[i], 'click', function() {
    infowindow.setContent(this['infowindow']);
    infowindow.open(map, this);
   });
  }
 }

 function calcRoute() {

        start  = new google.maps.LatLng(-8.580467, 115.163001);
        end = new google.maps.LatLng(-8.724085, 115.180407);
        var request = {
            origin: start,
            destination: end,
            travelMode: google.maps.DirectionsTravelMode.DRIVING
        };
        directionsService.route(request, function(response, status) {
   if (status == google.maps.DirectionsStatus.OK) {
     directionsDisplay.setDirections(response);
     addMarker();
   }
  });
    }

 window.onload = initialize;
</script>


3. Add new css for map (in <head> container)

<style type="text/css">
 #map_canvas{
    width: 400px;
    height: 300px;
 }
</style>


4. Then the last step, create the html code

<div id="map_canvas"></div>


Ok well done, save your file and try to run it.
Download complete source here
Hope it usefull, if there any question, just write your comment below.
I will replay asap ^^

Best regard,
Bayu Prawira