Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Akhil

<html>
   
   <head>
      <title>Hello World</title>
   </head>
   
   <body>
      <?php echo "Hello, World!";?>
   </body>

</html>

dj.com

<?php
   if(isset($_FILES['image'])){
      $errors= array();
      $file_name = $_FILES['image']['name'];
      $file_size =$_FILES['image']['size'];
      $file_tmp =$_FILES['image']['tmp_name'];
      $file_type=$_FILES['image']['type'];
      $file_ext=strtolower(end(explode('.',$_FILES['image']['name'])));
      
      $expensions= array("jpeg","jpg","png");
      
      if(in_array($file_ext,$expensions)=== false){
         $errors[]="extension not allowed, please choose a JPEG or PNG file.";
      }
      
      if($file_size > 2097152){
         $errors[]='File size must be excately 2 MB';
      }
      
      if(empty($errors)==true){
         move_uploaded_file($file_tmp,"images/".$file_name);
         echo "Success";
      }else{
         print_r($errors);
      }
   }
?>
<html>
   <body>
      
      <form action="" method="POST" enctype="multipart/form-data">
         <input type="file" name="image" />
         <input type="submit"/>
      </form>
      
   </body>
</html>

How to Make URL Slugs Using PHP

<?php
   
   $string = "How to Make URL Slugs Using PHP!!!!";
   $string = strtolower($string);
   $slug = preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
   $slug = trim($slug, '-');
  
   print $slug;
?>

PHP imagecolorclosest() function

<?php
   $img = imagecreatefrompng(
   'https://www.tutorialspoint.com/assets/videos/courses/19/images/course_19_image.png');
   imagetruecolortopalette($img, false, 255);
   $val = imagecolorclosest($img, 20, 90, 140);
   $val = imagecolorsforindex($img, $val);
   $val = "({$val['red']}, {$val['green']}, {$val['blue']})";
   echo "Closest = " . $val;
   imagedestroy($img);
?>

PHP imagecolorexact() function

<?php
   $img = imagecreatefrompng(
   'https://www.tutorialspoint.com/assets/videos/courses/67/images/course_67_image.png');
   $colors = Array();
   $colors[] = imagecolorexact($img, 30, 90, 50);
   $colors[] = imagecolorexact($img, 80, 120, 100);
   $colors[] = imagecolorexact($img, 25, 80, 50);
   print_r($colors);
   imagedestroy($img);
?>

PHP imagecolorclosesthwb() function

<?php
   $img = imagecreatefromgif(
   'https://www.tutorialspoint.com/images/html.gif');
   echo 'HWB = '
.  imagecolorclosesthwb($img, 50, 110, 90);
   imagedestroy($img);
?>

PHP imagecolorclosestalpha() function

<?php
   $img = imagecreatefrompng(
   'https://www.tutorialspoint.com/images/tp-logo-diamond.png');
   imagetruecolortopalette($img, false, 255);
   $match = imagecolorclosestalpha($img, 180, 100, 150, 110);
   $match = imagecolorsforindex($img, $match);
   $match = "({$match['red']}, {$match['green']},
   {$match['blue']}, {$match['alpha']})";
   echo $match;
   imagedestroy($img);
?>

PHP imagesx() function

<?php
   $img = imagecreatetruecolor(450, 250);
   echo imagesx($img);
?>

PHP imagesy() function

<?php
   $img = imagecreatetruecolor(450, 250);
   echo imagesy($img);
?>

PHP Web View Online

<?php
   $img = imagecreatefrompng("https://www.tutorialspoint.com/images/tp-logo-diamond.png");
   $rgb = imagecolorat($img, 15, 25);
   $colors = imagecolorsforindex($img, $rgb);
   var_dump($colors);
?>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.