Jump to content

PDO and Image Resizing


jackbravo

Recommended Posts

Hi all

I'm trying to get a script to resize an image and then save it to MySQL using PHP PDO.
After resizing an image one normally uses [b]imagejpeg[/b] to either display the image directly in the browser or save it to a file.
But I want to save it on the database, without having to store it on a temporary file.

The extra problem resides in that PDO uses streams to transfer LOBs to the database [url=http://www.php.net/pdo#AEN148731]http://www.php.net/pdo#AEN148731[/url]. So I dont think i can do something like:
[code]ob_start();
imagejpeg($resource);
$image = ob_get_contents();
ob_end_clean();

$stmt = $conn->prepare('INSERT INTO image ( ? )');
$stmt->execute($image);[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.