Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Posts posted by dreamwest

  1. Javascript is very similar to php so why not learn it.

     

    JavaScript is nothing like PHP. Syntax wise, maybe a little, but that is about where the similarities end. It has a completely different inheritance model based on prototypes.

     

    Yes darling similar - not identical

     

    Javascript

     

    function test(txt){
    if(txt){
    alert("Txt is valid");
    }else{
    alert("no txt");
    }
    }//end test

     

    Php

     

    function test($txt){
    if($txt){
    echo "Txt is valid";
    }else{
    echo "no txt";
    }
    }//end test

  2. User-agent: googlebot

    Request-rate: 1/10  # maximum rate is one page every 10 seconds.

     

    Thanks DW.

     

    1) Will it effect my SEO with Googlebots negatively, as i am restricting them to crawl slow?

     

    2) Do i need to register to Webmaster tool for this to work? (Because i do not want to register my site with Google Webmaster)

     

    Cheers

    N

     

    Just throw it in robots.txt and your done

  3. XMLs are just like arrays, you point to the keys you want

     

    $data = @file_get_contents("wiz.xml");
    
    $n_data = new SimpleXmlElement($data, LIBXML_NOCDATA);
    
    foreach ($n_data->xml->entry as $d) {
    
    $show .= "Userid: {$d->target_user->user_id} Mob: {$d->target_user->mob_name} Paid user: {$d->paid_user->user_id}<br>";
    }
    
    echo $show;

  4. simple_img.class.php

    <?php
    class SimpleImage {
       
       var $image;
       var $image_type;
    
       function load($filename) {
          $image_info = getimagesize($filename);
          $this->image_type = $image_info[2];
          if( $this->image_type == IMAGETYPE_JPEG ) {
             $this->image = imagecreatefromjpeg($filename);
          } elseif( $this->image_type == IMAGETYPE_GIF ) {
             $this->image = imagecreatefromgif($filename);
          } elseif( $this->image_type == IMAGETYPE_PNG ) {
             $this->image = imagecreatefrompng($filename);
          }
       }
       function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) {
          if( $image_type == IMAGETYPE_JPEG ) {
             imagejpeg($this->image,$filename,$compression);
          } elseif( $image_type == IMAGETYPE_GIF ) {
             imagegif($this->image,$filename);         
          } elseif( $image_type == IMAGETYPE_PNG ) {
             imagepng($this->image,$filename);
          }   
          if( $permissions != null) {
             chmod($filename,$permissions);
          }
       }
       function output($image_type=IMAGETYPE_JPEG) {
          if( $image_type == IMAGETYPE_JPEG ) {
             imagejpeg($this->image);
          } elseif( $image_type == IMAGETYPE_GIF ) {
             imagegif($this->image);         
          } elseif( $image_type == IMAGETYPE_PNG ) {
             imagepng($this->image);
          }   
       }
       function getWidth() {
          return imagesx($this->image);
       }
       function getHeight() {
          return imagesy($this->image);
       }
       function resizeToHeight($height) {
          $ratio = $height / $this->getHeight();
          $width = $this->getWidth() * $ratio;
          $this->resize($width,$height);
       }
       function resizeToWidth($width) {
          $ratio = $width / $this->getWidth();
          $height = $this->getheight() * $ratio;
          $this->resize($width,$height);
       }
       function scale($scale) {
          $width = $this->getWidth() * $scale/100;
          $height = $this->getheight() * $scale/100; 
          $this->resize($width,$height);
       }
       function resize($width,$height) {
          $new_image = imagecreatetruecolor($width, $height);
          imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
          imagefilter($new_image, IMG_FILTER_CONTRAST, -10);
          $this->image = $new_image;   
       }      
    }
    ?>

     

     

    include('simple_img.class.php');
    
    $image = new SimpleImage();
    $image->load("img.png");
    $image->resize(100,100);
    $image->save("img2.png");
    

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.