FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » is mysqli_real_escape_string bullet proof with binary data?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: is mysqli_real_escape_string bullet proof with binary data? [message #182285 is a reply to message #182279] Sat, 27 July 2013 14:33 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
On 27/07/13 14:35, Norman Peelman wrote:
> On 07/27/2013 05:31 AM, The Natural Philosopher wrote:
>> The target is to create and store thumbnail PNG images in a Mysql table.
>> Also any tips on actually getting the thumbnail data into a variable -
>> which package is recommended? I've always used GD, but never been 100%
>> happy with it
>>
>
> Well, you don't sat why you don't like GD but that is what I use (on
> one of my sites) so here is what I do---
>
> When writing *to* the database:
> A) You have sql LOAD_FILE to store a file (filesystem) in the db.
>
> I write the GD image resource to a tmp file and then store it using
> LOAD_FILE.
>
> imagepng($img, $destfile);
> /* stuff */
> $query = "UPDATE table SET img_data = LOAD_FILE('$destfile') WHERE ?"
>

that's what I have used in the past..
> B) ??
>
>
> When retrieving *from* the db:
> A) The binary data is in the result set such that:
>
> header("Content-Type: image/png");
> echo $result['image_data']
>
> -or-
>
> You can create a GD image resource by using:
>
> $img = imagecreatefromstring($result['image_data']);
> /* GD manipulations */
> header("Content-Type: image/png");
> imagepng($img);
>
> either should output an image to the browser.
>
> B) output_buffering lets you do some crazy stuff.
>
>
> -or-
>
> Take a look at the Imagick module for PHP (PECL).
>
I will. TIA

> http://www.php.net/manual/en/imagick.getimageblob.php
> http://www.php.net/manual/en/imagick.readimageblob.php
> http://www.php.net/manual/en/imagick.readimagefile.php
>


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Major trouble with PhpDocumentor
Next Topic: Education Path to become a PHP developer using free online courses
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 03:02:16 GMT 2024

Total time taken to generate the page: 0.04628 seconds