Check if JPEGs are supported in PHP

Description

The following code shows how to check if JPEGs are supported.

Example


//w ww  .ja  va 2  s .  c om
<?php
    $supported = imagetypes();
    if($supported & IMG_JPG) {
              echo "Jpegs are supported in this GD version";
    } else {
              echo "Jpegs are not supported.";
    }
?>

The code above generates the following result.

Check if JPEGs are supported in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text