var_dump and sizeof database entry?

From: Date: Thu, 05 Jan 2006 22:19:43 +0000
Subject: var_dump and sizeof database entry?
Groups: php.db 
Request: Send a blank email to php-db+get-40977@lists.php.net to get a copy of this message
Hello, This is stumping me something awful. I have searched the archive of this mailing list and google and the php and mysql websites with everything i can think of. I have a simple mysql table with some basic columns and a blob column that holds an image file. What I need to get is the size of this image file for use with an rss feed (the enclosure "length" parameter). In the simplest case, I thought I would just read the entire blob into a variable, and then I would be able to get the size of this variable. However, php does not seem to have a function to do this. Inexplicably, the "var_dump" command will actually dump the information I want, but it is very memory inefficient, because I get something like: ["preview"]=> string(17888) "ENTIRE CONTENTS OF BLOB HERE" where all I really want is the 17888 value (for a 17.5 KB file). What I was wondering is if there is a simple way to get this information from mysql directly without having to 1) select the blob column and 2) do a var_dump with output buffering and parsing for the parenthetical file size, which seems very inefficient to me. any insight is greatly appreciated. Jordan

« previous php.db (#40977) next »