Re: [PHP] Fw: Data from SQL to a string in a useable format
Just a note about this: I am starting to play with the base64_encode function It does indeed create a bigger string than the original, *BUT*, I've also found that if you use the following: $img = gzcompress(base64_encode(fread(fopen($userfile, "r"), filesize($userfile; your end result will be even smaller than the original image string, that you would get from running: $img = addslashes(fread(fopen($userfile, "r"), filesize($userfile))); Original Image, slashes added: 27941 Base64 Encoded: 36256 Base64 Encoded, Compressed:26785 - Original Message - From: "Jason Bell" <[EMAIL PROTECTED]> To: "Sheridan Saint-Michel" <[EMAIL PROTECTED]>; "php-general" <[EMAIL PROTECTED]> Sent: Wednesday, July 18, 2001 12:02 PM Subject: Re: [PHP] Fw: Data from SQL to a string in a useable format > I will certainly give it a try... Thanks! > > - Original Message - > From: "Sheridan Saint-Michel" <[EMAIL PROTECTED]> > To: "php-general" <[EMAIL PROTECTED]> > Sent: Wednesday, July 18, 2001 11:57 AM > Subject: Re: [PHP] Fw: Data from SQL to a string in a useable format > > > > This may be way out in left field... but since no one else seems to be > > answering, > > > > Have you considered using something like base64_encode? > > http://www.php.net/manual/en/function.base64-encode.php > > > > That would change your image to plaintext without any characters that need > > to be escaped. > > > > The when you retrieve it you would just run it through base64_decode and > > viola! > > > > I have never tried this, and like I said there may very well be a better > > solution. > > (Especially since the DB is usually the bottleneck and base64_encode > > actually makes the file bigger) > > > > Let me know if that helps > > Sheridan > > > > - Original Message - > > From: Jason Bell <[EMAIL PROTECTED]> > > To: PHP Users <[EMAIL PROTECTED]> > > Sent: Wednesday, July 18, 2001 11:51 AM > > Subject: [PHP] Fw: Data from SQL to a string in a useable format > > > > > > Ok, never got a reply yesterday, so I figured I'd resend this. can > this > > even be done? > > __ > > > > How can I pull my data from my SQL db, and store it as a string so that it > > can be used? Specificly, I'm working with images. > > > > When the images are stored in the database, the only pre-processing that > is > > done is: > > > > $img = addslashes(fread(fopen($userfile, "r"), filesize($userfile))); > > > > (* note: $userfile is the file identifier from my upload form.) > > > > I want to pull the data out of the database and store it in a string, so > > that I can use imagecopyresampled to create a thumbnail, but I just can't > > seem to get it to work > > > > please help!! > > > > Thanks, Jason > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Fw: Data from SQL to a string in a useable format
I will certainly give it a try... Thanks! - Original Message - From: "Sheridan Saint-Michel" <[EMAIL PROTECTED]> To: "php-general" <[EMAIL PROTECTED]> Sent: Wednesday, July 18, 2001 11:57 AM Subject: Re: [PHP] Fw: Data from SQL to a string in a useable format > This may be way out in left field... but since no one else seems to be > answering, > > Have you considered using something like base64_encode? > http://www.php.net/manual/en/function.base64-encode.php > > That would change your image to plaintext without any characters that need > to be escaped. > > The when you retrieve it you would just run it through base64_decode and > viola! > > I have never tried this, and like I said there may very well be a better > solution. > (Especially since the DB is usually the bottleneck and base64_encode > actually makes the file bigger) > > Let me know if that helps > Sheridan > > - Original Message - > From: Jason Bell <[EMAIL PROTECTED]> > To: PHP Users <[EMAIL PROTECTED]> > Sent: Wednesday, July 18, 2001 11:51 AM > Subject: [PHP] Fw: Data from SQL to a string in a useable format > > > Ok, never got a reply yesterday, so I figured I'd resend this. can this > even be done? > __ > > How can I pull my data from my SQL db, and store it as a string so that it > can be used? Specificly, I'm working with images. > > When the images are stored in the database, the only pre-processing that is > done is: > > $img = addslashes(fread(fopen($userfile, "r"), filesize($userfile))); > > (* note: $userfile is the file identifier from my upload form.) > > I want to pull the data out of the database and store it in a string, so > that I can use imagecopyresampled to create a thumbnail, but I just can't > seem to get it to work > > please help!! > > Thanks, Jason > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Fw: Data from SQL to a string in a useable format
This may be way out in left field... but since no one else seems to be answering, Have you considered using something like base64_encode? http://www.php.net/manual/en/function.base64-encode.php That would change your image to plaintext without any characters that need to be escaped. The when you retrieve it you would just run it through base64_decode and viola! I have never tried this, and like I said there may very well be a better solution. (Especially since the DB is usually the bottleneck and base64_encode actually makes the file bigger) Let me know if that helps Sheridan - Original Message - From: Jason Bell <[EMAIL PROTECTED]> To: PHP Users <[EMAIL PROTECTED]> Sent: Wednesday, July 18, 2001 11:51 AM Subject: [PHP] Fw: Data from SQL to a string in a useable format Ok, never got a reply yesterday, so I figured I'd resend this. can this even be done? __ How can I pull my data from my SQL db, and store it as a string so that it can be used? Specificly, I'm working with images. When the images are stored in the database, the only pre-processing that is done is: $img = addslashes(fread(fopen($userfile, "r"), filesize($userfile))); (* note: $userfile is the file identifier from my upload form.) I want to pull the data out of the database and store it in a string, so that I can use imagecopyresampled to create a thumbnail, but I just can't seem to get it to work please help!! Thanks, Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Fw: Data from SQL to a string in a useable format
Ok, never got a reply yesterday, so I figured I'd resend this. can this even be done? __ How can I pull my data from my SQL db, and store it as a string so that it can be used? Specificly, I'm working with images. When the images are stored in the database, the only pre-processing that is done is: $img = addslashes(fread(fopen($userfile, "r"), filesize($userfile))); (* note: $userfile is the file identifier from my upload form.) I want to pull the data out of the database and store it in a string, so that I can use imagecopyresampled to create a thumbnail, but I just can't seem to get it to work please help!! Thanks, Jason