Parastatidis Nikos
Jun 27 2005, 10:06 AM
hi there
i have some images on blob fields on mysql
is there a way to manipulate them directrly from the image stream i get from
mysql?
or i have to write the stream on a file first?
because most image functions of php take filenames as variables
is there any way to manipulate images directly from mysql?
Thanks in advance.
nemo
Jun 27 2005, 10:24 AM
On Mon, 27 Jun 2005 14:06:59 +0300, "Parastatidis Nikos" <[Email Removed]>
wrote:
QUOTE |
hi there
i have some images on blob fields on mysql
is there a way to manipulate them directrly from the image stream i get from mysql? or i have to write the stream on a file first?
because most image functions of php take filenames as variables is there any way to manipulate images directly from mysql?
Thanks in advance.
When you say "manipulate" them, what are you after, exactly? |
I can't answer your question directly, but it's generally considered to be a
Bad Idea to store images in the database. Instead, store the image_filename
only, and control everything else via the output string.
Unless you have a truly horrendous number of images, I would suggest you
re-arrange your set-up as above.
Parastatidis Nikos
Jun 27 2005, 10:45 AM
i have some customers images on blob fields
i have an image template that i whan to use it as background and merge the
customer image with the template
this is what i mean manipulate gernaly handle the image directly as taken
from the database and not storeing temporary on a file.
is this posible?
or do i have fopen and put the stream from the database on a temp file.
"Parastatidis Nikos" <[Email Removed]> wrote in message
news:d9ommu$239$[Email Removed]...
QUOTE |
hi there
i have some images on blob fields on mysql
is there a way to manipulate them directrly from the image stream i get from mysql? or i have to write the stream on a file first?
because most image functions of php take filenames as variables is there any way to manipulate images directly from mysql?
Thanks in advance.
|
nemo
Jun 27 2005, 01:01 PM
On Mon, 27 Jun 2005 14:45:31 +0300, "Parastatidis Nikos" <[Email Removed]>
wrote:
QUOTE |
i have some customers images on blob fields i have an image template that i whan to use it as background and merge the customer image with the template this is what i mean manipulate gernaly handle the image directly as taken from the database and not storeing temporary on a file. is this posible? or do i have fopen and put the stream from the database on a temp file. Are you wanting to go something like - |
<img src="$Row[image]">
as opposed to
<img src="image_directory/$Row[image_filename]">?
What have you tried?
I repeat - it's best to store only the filename.
Stefan Rybacki
Jun 27 2005, 01:57 PM
nemo wrote:
QUOTE |
On Mon, 27 Jun 2005 14:45:31 +0300, "Parastatidis Nikos" <[Email Removed] wrote:
i have some customers images on blob fields i have an image template that i whan to use it as background and merge the customer image with the template this is what i mean manipulate gernaly handle the image directly as taken from the database and not storeing temporary on a file. is this posible? or do i have fopen and put the stream from the database on a temp file. Are you wanting to go something like - <img src="$Row[image]" as opposed to <img src="image_directory/$Row[image_filename]">? What have you tried? I repeat - it's best to store only the filename.
|
I guess I wants more like this:
$img1=createFromStream($row['img1']);
$img2=createFromStream($row['img2']);
$newimg=mergeImages($img1,$img1);
and then for example store it
imageJpeg($newimg,'filename.jpg');
print('<img src="filename.jpg">');
but I think he is wants to do something more like this:
header("image/jpeg");
imageJpeg($newimg);
HTML - File somewhere
....
<img src="mergedImages.php?image1=7&image2=9">
The OP should help to know what he wants.
Regards
Stefan
Parastatidis Nikos
Jun 27 2005, 02:08 PM
imagecreatefromstring()
this is what i whanted and my eye didnt catch it from the manual
thanks alot stefan.
"Stefan Rybacki" <[Email Removed]> wrote in message
news:[Email Removed]...
QUOTE |
nemo wrote: On Mon, 27 Jun 2005 14:45:31 +0300, "Parastatidis Nikos" <[Email Removed] wrote:
i have some customers images on blob fields i have an image template that i whan to use it as background and merge the customer image with the template this is what i mean manipulate gernaly handle the image directly as taken from the database and not storeing temporary on a file. is this posible? or do i have fopen and put the stream from the database on a temp file. Are you wanting to go something like - <img src="$Row[image]" as opposed to <img src="image_directory/$Row[image_filename]">? What have you tried? I repeat - it's best to store only the filename.
I guess I wants more like this:
$img1=createFromStream($row['img1']); $img2=createFromStream($row['img2']);
$newimg=mergeImages($img1,$img1);
and then for example store it
imageJpeg($newimg,'filename.jpg'); print('<img src="filename.jpg">');
but I think he is wants to do something more like this:
header("image/jpeg"); imageJpeg($newimg);
HTML - File somewhere
... <img src="mergedImages.php?image1=7&image2=9"
The OP should help to know what he wants.
Regards Stefan |
nemo
Jun 27 2005, 02:32 PM
On Mon, 27 Jun 2005 18:08:19 +0300, "Parastatidis Nikos" <[Email Removed]>
wrote:
QUOTE |
imagecreatefromstring() this is what i whanted and my eye didnt catch it from the manual thanks alot stefan.
"Stefan Rybacki" <[Email Removed]> wrote in message news:[Email Removed]... nemo wrote: On Mon, 27 Jun 2005 14:45:31 +0300, "Parastatidis Nikos" <[Email Removed] wrote:
i have some customers images on blob fields i have an image template that i whan to use it as background and merge the customer image with the template this is what i mean manipulate gernaly handle the image directly as taken from the database and not storeing temporary on a file. is this posible? or do i have fopen and put the stream from the database on a temp file. Are you wanting to go something like - <img src="$Row[image]" as opposed to <img src="image_directory/$Row[image_filename]">? What have you tried? I repeat - it's best to store only the filename.
I guess I wants more like this:
$img1=createFromStream($row['img1']); $img2=createFromStream($row['img2']);
$newimg=mergeImages($img1,$img1);
and then for example store it
imageJpeg($newimg,'filename.jpg'); print('<img src="filename.jpg">');
but I think he is wants to do something more like this:
header("image/jpeg"); imageJpeg($newimg);
HTML - File somewhere
... <img src="mergedImages.php?image1=7&image2=9"
The OP should help to know what he wants.
Regards Stefan
php.net says - |
QUOTE
resource imagecreate ( int x_size, int y_size )
imagecreate() returns an image identifier representing a blank image of size
x_size by y_size.
UNQUOTE
So that means (I think!) that he's creating a blank image of a certain size
which he then fills with the contents of a blob from his database.
As this seems to me to be duplication, what advantage (if any) does his that
have over "my" preference, or under what circumstancesd should I choose it?
Stefan Rybacki
Jun 27 2005, 03:16 PM
nemo wrote:
QUOTE |
On Mon, 27 Jun 2005 18:08:19 +0300, "Parastatidis Nikos" <[Email Removed] wrote:
imagecreatefromstring() this is what i whanted and my eye didnt catch it from the manual thanks alot stefan.
"Stefan Rybacki" <[Email Removed]> wrote in message news:[Email Removed]... nemo wrote: On Mon, 27 Jun 2005 14:45:31 +0300, "Parastatidis Nikos" <[Email Removed] wrote:
i have some customers images on blob fields i have an image template that i whan to use it as background and merge the customer image with the template this is what i mean manipulate gernaly handle the image directly as taken from the database and not storeing temporary on a file. is this posible? or do i have fopen and put the stream from the database on a temp file. Are you wanting to go something like - <img src="$Row[image]" as opposed to <img src="image_directory/$Row[image_filename]">? What have you tried? I repeat - it's best to store only the filename.
I guess I wants more like this:
$img1=createFromStream($row['img1']); $img2=createFromStream($row['img2']);
$newimg=mergeImages($img1,$img1);
and then for example store it
imageJpeg($newimg,'filename.jpg'); print('<img src="filename.jpg">');
but I think he is wants to do something more like this:
header("image/jpeg"); imageJpeg($newimg);
HTML - File somewhere
... <img src="mergedImages.php?image1=7&image2=9"
The OP should help to know what he wants.
Regards Stefan
php.net says - QUOTE resource imagecreate ( int x_size, int y_size )
imagecreate() returns an image identifier representing a blank image of size x_size by y_size. UNQUOTE So that means (I think!) that he's creating a blank image of a certain size which he then fills with the contents of a blob from his database.
As this seems to me to be duplication, what advantage (if any) does his that have over "my" preference, or under what circumstancesd should I choose it?
|
Its correct, you should not store the images data into the database but
a reference to the images location on the server. So you are right with
your suggestion to store the image outside the database.
But the OP is right to load the image via imagecreatefromstring or
imagecreatefromjpeg, whatever, if he wants to merge two pictures together.
Regards
Stefan
nemo
Jun 27 2005, 08:01 PM
On Mon, 27 Jun 2005 18:16:05 +0200, Stefan Rybacki <[Email Removed]>
wrote:
QUOTE |
nemo wrote: On Mon, 27 Jun 2005 18:08:19 +0300, "Parastatidis Nikos" <[Email Removed] wrote:
imagecreatefromstring() this is what i whanted and my eye didnt catch it from the manual thanks alot stefan.
"Stefan Rybacki" <[Email Removed]> wrote in message news:[Email Removed]... nemo wrote: On Mon, 27 Jun 2005 14:45:31 +0300, "Parastatidis Nikos" <[Email Removed] wrote:
i have some customers images on blob fields i have an image template that i whan to use it as background and merge the customer image with the template this is what i mean manipulate gernaly handle the image directly as taken from the database and not storeing temporary on a file. is this posible? or do i have fopen and put the stream from the database on a temp file. Are you wanting to go something like - <img src="$Row[image]" as opposed to <img src="image_directory/$Row[image_filename]">? What have you tried? I repeat - it's best to store only the filename.
I guess I wants more like this:
$img1=createFromStream($row['img1']); $img2=createFromStream($row['img2']);
$newimg=mergeImages($img1,$img1);
and then for example store it
imageJpeg($newimg,'filename.jpg'); print('<img src="filename.jpg">');
but I think he is wants to do something more like this:
header("image/jpeg"); imageJpeg($newimg);
HTML - File somewhere
... <img src="mergedImages.php?image1=7&image2=9"
The OP should help to know what he wants.
Regards Stefan
php.net says - QUOTE resource imagecreate ( int x_size, int y_size )
imagecreate() returns an image identifier representing a blank image of size x_size by y_size. UNQUOTE So that means (I think!) that he's creating a blank image of a certain size which he then fills with the contents of a blob from his database.
As this seems to me to be duplication, what advantage (if any) does his that have over "my" preference, or under what circumstancesd should I choose it?
Its correct, you should not store the images data into the database but a reference to the images location on the server. So you are right with your suggestion to store the image outside the database. But the OP is right to load the image via imagecreatefromstring or imagecreatefromjpeg, whatever, if he wants to merge two pictures together.
Regards Stefan I guess he has to work the image for degrees of transparency, then? (I |
dunno - there *has* to be a simpler way. Oh well, I don't think it's
anything to trouble me, anyway.)
Kimmo Laine
Jun 27 2005, 08:13 PM
"nemo" <nemo@not_hotmail.com> kirjoitti
viestiss:[Email Removed]...
QUOTE |
On Mon, 27 Jun 2005 18:16:05 +0200, Stefan Rybacki <[Email Removed] wrote:
nemo wrote: On Mon, 27 Jun 2005 18:08:19 +0300, "Parastatidis Nikos" <[Email Removed] wrote:
imagecreatefromstring() this is what i whanted and my eye didnt catch it from the manual thanks alot stefan.
"Stefan Rybacki" <[Email Removed]> wrote in message news:[Email Removed]... nemo wrote: On Mon, 27 Jun 2005 14:45:31 +0300, "Parastatidis Nikos" <[Email Removed] wrote:
i have some customers images on blob fields i have an image template that i whan to use it as background and merge the customer image with the template this is what i mean manipulate gernaly handle the image directly as taken from the database and not storeing temporary on a file. is this posible? or do i have fopen and put the stream from the database on a temp file. Are you wanting to go something like - <img src="$Row[image]" as opposed to <img src="image_directory/$Row[image_filename]">? What have you tried? I repeat - it's best to store only the filename.
I guess I wants more like this:
$img1=createFromStream($row['img1']); $img2=createFromStream($row['img2']);
$newimg=mergeImages($img1,$img1);
and then for example store it
imageJpeg($newimg,'filename.jpg'); print('<img src="filename.jpg">');
but I think he is wants to do something more like this:
header("image/jpeg"); imageJpeg($newimg);
HTML - File somewhere
... <img src="mergedImages.php?image1=7&image2=9"
The OP should help to know what he wants.
Regards Stefan
php.net says - QUOTE resource imagecreate ( int x_size, int y_size )
imagecreate() returns an image identifier representing a blank image of size x_size by y_size. UNQUOTE So that means (I think!) that he's creating a blank image of a certain size which he then fills with the contents of a blob from his database.
As this seems to me to be duplication, what advantage (if any) does his that have over "my" preference, or under what circumstancesd should I choose it?
Its correct, you should not store the images data into the database but a reference to the images location on the server. So you are right with your suggestion to store the image outside the database. But the OP is right to load the image via imagecreatefromstring or imagecreatefromjpeg, whatever, if he wants to merge two pictures together.
Regards Stefan I guess he has to work the image for degrees of transparency, then? (I dunno - there *has* to be a simpler way. Oh well, I don't think it's anything to trouble me, anyway.)
|
using png-related functions gives you the full power of alpha layers, thus
making it quite easy to work with transparency then.
--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears
[Email Removed]
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.