It's free and you have access to premium codes!
Welcome back! Please login to your account.
Don't worry, we'll send you a message to help you to recover your acount.
Please check your email for instructions to activate your account.
Written by 21 November 2012
If you have images on your site and want to find their characteristics such as Height, Width and etc., this script helps you by preparing a function that needs just the image file path! Enjoy.
<!-- this script is provided by https://www.phpfreecode.com coded by: Kerixa Inc. -->
<!-- This Script is from www.phpfreecpde.com, Coded by: Kerixa Inc-->
<?php
$img='1.jpg';
print_r(image_get_info($img));
function image_get_info($file) {
// Proceed no further if this file doesn't exist. Some web servers (IIS) may
// not pass is_file() for newly uploaded files, so we need two checks here.
if (!is_file($file) && !is_uploaded_file($file)) {
return FALSE;
}
$details = FALSE;
$data = @getimagesize($file);
$file_size = @filesize($file);
if (isset($data) && is_array($data)) {
$extensions = array(
'1' => 'gif',
'2' => 'jpg',
'3' => 'png',
);
$extension = array_key_exists($data[2], $extensions) ? $extensions[$data[2]] : '';
$details = array(
'width' => $data[0],
'height' => $data[1],
'extension' => $extension,
'file_size' => $file_size,
'mime_type' => $data['mime'],
);
}
return $details;
}
?>
<br><br><font face="Tahoma"><a target="_blank" href="http://www.phpfreecode.com/"><span style="font-size: 8pt; text-decoration: none">PHP Free Code</span></a></font><a target='_blank' href='https://www.phpfreecode.com' style='font-size: 8pt; text-decoration: none'>Php Best Codes</a>
Comments
Here you can leave us commments. Let us know what you think about this code tutorial!