Date: 07/30/01
- Next message: bvr <email protected>: "[PHP-DEV] Bug #12468: --enable-gd-native-ttf option not detected"
- Previous message: Alexander Merz: "Re: [PHP-DEV] new manual chapter suggestion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 10166
Updated by: sniper
Reported By: vvo <email protected>
Old Status: Open
Status: Feedback
Bug Type: *Graphics related
Operating System: Linux 2.2
PHP Version: 4.0 Latest CVS (04/04/2001)
New Comment:
In latest CVS there I have added an optional parameter
for read_exif_data():
proto read_exif_data(string filename [, int readall])
By setting 'readall' to 0 you can prevent it from
loading all of the file into memory.
Please test this.
--Jani
Previous Comments:
------------------------------------------------------------------------
[2001-04-04 13:48:56] vvo <email protected>
Some users observed that read_exif_data is too slow with 1MB image files, which is a typical size for digital camera output. I looked into the implementation (ext/exif/exif.c) and it looks like the whole compressed image data is always read into memory, even though read_exif_data should be concerned with just the file header.
Here's a line from function read_exif_data:
<PRE>
ret = php_read_jpeg_exif(&ImageInfo, (*p_name)->value.str.val,1);
</PRE>
The last parameter (ReadAll=1), causes the whole image data loaded into memory inside function scan_JPEG_header:
<PRE>
if (ReadAll) {
int cp, ep, size;
/* Determine how much file is left. */
cp = ftell(infile);
fseek(infile, 0, SEEK_END);
ep = ftell(infile);
fseek(infile, cp, SEEK_SET);
size = ep-cp;
Data = (uchar *)malloc(size);
if (Data == NULL) {
php_error(E_ERROR,"could not allocate data for entire image");
}
got = fread(Data, 1, size, infile);
if (got != size) {
php_error(E_ERROR,"could not read the rest of the image");
}
Sections[*SectionsRead].Data = Data;
Sections[*SectionsRead].Size = size;
Sections[*SectionsRead].Type = PSEUDO_IMAGE_MARKER;
(*SectionsRead)++;
/*
*HaveAll = 1;
*/
}
return TRUE;
</PRE>
I believe the line above should be changed to feed 0 as value of parameter ReadAll.
Thanks.
V
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=10166&edit=1
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: bvr <email protected>: "[PHP-DEV] Bug #12468: --enable-gd-native-ttf option not detected"
- Previous message: Alexander Merz: "Re: [PHP-DEV] new manual chapter suggestion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

