PHP-Fusion
v.7.01
AP-Fusion
v7.02.05
Pimped-Fusion-AP
v0.09.03
April 29 2024 02:40:31
Авторизация
Логин

Пароль



Вы не зарегистрированы?
Нажмите здесь для регистрации.

Забыли пароль?
Запросите новый здесь.
Мини-чат
Вы должны авторизироваться, чтобы добавить сообщение.

lom
06/04/2018 14:03
Мы рады, ждем девятку. Очень хочется пощупать

Alipapa
27/03/2018 22:16
Всем привет, все неисправности устранили, всё у нас работает

mukaton
30/10/2015 02:37
Не получается ничего скачать. Ошибка Not Found

Alipapa
06/10/2015 23:00
9-я версия php-fusion на подходе, следите за новостями

Alipapa
10/11/2014 11:24
Заметь, я дважды ответил через 3 минуты после вопроса, могли бы уже решить

Последние статьи
· О стабилизаторах нап...
· СМС и Вебмани
· TinyMCE для пользова...
· PCRE (Perl Compatibl...
· PCRE (Perl Compatibl...
Последние активные темы форума
  Темы Просмотров Ответов Последние сообщения
PHP-Fusion 7 Bogatyr - бесп...
Моды, плагины
7151 1 Vveb--ws
08-10-2018 16:47
Php-Fusion v9. Первые впеча...
Вопросы по работе
4518 3 Vveb--ws
25-07-2018 13:46
Появился хэлп по PHP-Fusion...
Вопросы по работе
6749 7 Vveb--ws
25-07-2018 13:42
prestashop&ap-fusion
Вопросы по работе
17379 61 Alipapa
26-08-2014 10:29
Плагин магазина Ap-Shop
Моды, плагины
14616 70 Alipapa
18-08-2014 18:14
TinyMCE
Вопросы по работе
21130 55 Alipapa
27-07-2013 21:57
HTML-5
Моды, плагины
5439 1 Alipapa
15-06-2013 19:47
Мультиязычность в Pimped-Fu...
Ошибки, баги, глюки
6270 4 Papich
16-04-2013 12:39
Pimped-Fusion. Первые впеча...
Ошибки, баги, глюки
21738 127 Alipapa
18-12-2012 10:59
Ищу мод для расстановки код...
Моды, плагины
15024 55 Alipapa
17-09-2012 14:00
Как присоединить файл к лич...
Моды, плагины
8268 3 lom
27-05-2012 18:12
Что мне не нравится в после...
Вопросы по работе
6860 4 Alipapa
27-05-2012 18:08
Проблемы с добавлением кате...
Вопросы по работе
7754 5 Alipapa
27-05-2012 18:06

getimagesize

(PHP 3, PHP 4 , PHP 5)

getimagesize -- Get the size of an image

Description

array getimagesize ( string filename [, array &imageinfo] )

The getimagesize() function will determine the size of any GIF, JPG, PNG, SWF, SWC, PSD, TIFF, BMP, IFF, JP2, JPX, JB2, JPC, XBM, or WBMP image file and return the dimensions along with the file type and a height/width text string to be used inside a normal HTML IMG tag.

If accessing the filename image is impossible, or if it isn't a valid picture, getimagesize() will return FALSE and generate an error of level E_WARNING.

Замечание: Support for JPC, JP2, JPX, JB2, XBM, and WBMP became available in PHP 4.3.2. Support for SWC exists as of PHP 4.3.0 and TIFF support was added in PHP 4.2.0

Замечание: JPEG 2000 support was added in PHP 4.3.2. Note that JPC and JP2 are capable of having components with different bit depths. In this case, the value for "bits" is the highest bit depth encountered. Also, JP2 files may contain multiple JPEG 2000 codestreams. In this case, getimagesize() returns the values for the first codestream it encounters in the root of the file.

Замечание: The getimagesize() function does not require the GD image library.

Returns an array with 4 elements. Index 0 contains the width of the image in pixels. Index 1 contains the height. Index 2 is a flag indicating the type of the image: 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM. These values correspond to the IMAGETYPE constants that were added in PHP 4.3.0. Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag.

Пример 1. getimagesize (file)

<?php
list( $width , $height , $type , $attr ) = getimagesize ( "img/flag.jpg" );
echo
"<img src= \" img/flag.jpg \" $attr alt= \" getimagesize() example \" />" ;
?>

URL support was added in PHP 4.0.5

Пример 2. getimagesize (URL)

<?php
$size
= getimagesize ( "http://www.example.com/gifs/logo.gif" );

// if the file name has space in it, encode it properly
$size = getimagesize ( "http://www.example.com/gifs/lo%20go.gif" );

?>

With JPG images, two extra indexes are returned: channels and bits. channels will be 3 for RGB pictures and 4 for CMYK pictures. bits is the number of bits for each color.

Beginning with PHP 4.3.0, bits and channels are present for other image types, too. However, the presence of these values can be a bit confusing. As an example, GIF always uses 3 channels per pixel, but the number of bits per pixel cannot be calculated for an animated GIF with a global color table.

Some formats may contain no image or may contain multiple images. In these cases, getimagesize() might not be able to properly determine the image size. getimagesize() will return zero for width and height in these cases.

Beginning with PHP 4.3.0, getimagesize() also returns an additional parameter, mime, that corresponds with the MIME type of the image. This information can be used to deliver images with correct HTTP Content-type headers:

Пример 3. getimagesize() and MIME types

<?php
$size
= getimagesize ( $filename );
$fp = fopen ( $filename , "rb" );
if (
$size && $fp ) {
  
header ( "Content-type: { $size [ 'mime' ]} " );
  
fpassthru ( $fp );
  exit;
} else {
  
// error
}
?>

The optional imageinfo parameter allows you to extract some extended information from the image file. Currently, this will return the different JPG APP markers as an associative array. Some programs use these APP markers to embed text information in images. A very common one is to embed IPTC http://www.iptc.org/ information in the APP13 marker. You can use the iptcparse() function to parse the binary APP13 marker into something readable.

Пример 4. getimagesize() returning IPTC

<?php
$size
= getimagesize ( "testimg.jpg" , $info );
if (isset(
$info [ "APP13" ])) {
    
$iptc = iptcparse ( $info [ "APP13" ]);
    
var_dump ( $iptc );
}
?>

Смотрите также image_type_to_mime_type(), exif_imagetype(), exif_read_data() and exif_thumbnail().

Все функции PHP:
Навигация
· Новости
· Статьи
· Скачать
· Форум
· Ссылки
· Категории новостей
· Обратная связь
· Галерея
· Поиск
· CMS AP-Fusion. Отличия от PHP-Fusion
· Javascript справочник
· Техника
Сейчас на сайте
· Гостей: 1

· Пользователей: 0

· Всего пользователей: 453
· Новый пользователь: ZDA
Информеры
Загрузка файлов  +  -
9,953,617 уникальных посетителей Iceberg by Harly