Professional Web Applications Themes

image manipulation from mysql - PHP Development

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....

  1. #1

    Default image manipulation from mysql

    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.


    Parastatidis Guest

  2. #2

    Default Re: image manipulation from mysql

    On Mon, 27 Jun 2005 14:06:59 +0300, "Parastatidis Nikos" <gr>
    wrote:
     
    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.
    nemo Guest

  3. #3

    Default Re: image manipulation from mysql

    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" <gr> wrote in message
    news:d9ommu$239$grnet.gr... 


    Parastatidis Guest

  4. #4

    Default Re: image manipulation from mysql

    On Mon, 27 Jun 2005 14:45:31 +0300, "Parastatidis Nikos" <gr>
    wrote:
     
    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.
    nemo Guest

  5. #5

    Default Re: image manipulation from mysql

    nemo wrote: 
    > 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.[/ref]

    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
    Stefan Guest

  6. #6

    Default Re: image manipulation from mysql

    imagecreatefromstring()
    this is what i whanted and my eye didnt catch it from the manual
    thanks alot stefan.


    "Stefan Rybacki" <net> wrote in message
    news:net... 
    >> merge the 
    >> taken 
    >> 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.[/ref]
    >
    > 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[/ref]


    Parastatidis Guest

  7. #7

    Default Re: image manipulation from mysql

    On Mon, 27 Jun 2005 18:08:19 +0300, "Parastatidis Nikos" <gr>
    wrote:
     
    >>
    >> 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[/ref]
    >[/ref]
    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 cirstancesd should I choose it?
    nemo Guest

  8. #8

    Default Re: image manipulation from mysql

    nemo wrote: 
    > >[/ref]
    > 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 cirstancesd should I choose it?[/ref]

    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
    Stefan Guest

  9. #9

    Default Re: image manipulation from mysql

    On Mon, 27 Jun 2005 18:16:05 +0200, Stefan Rybacki <net>
    wrote:
     
    >> 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 cirstancesd should I choose it?[/ref]
    >
    >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[/ref]
    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.)
    nemo Guest

  10. #10

    Default Re: image manipulation from mysql

    "nemo" <com> kirjoitti
    viestissä:com... [/ref]
    > <gr> [/ref]
    > background and [/ref]
    > directly as [/ref]
    > a temp [/ref]
    > of size [/ref]
    > certain size [/ref]
    > his that [/ref]
    > choose it? 
    > together. 
    > 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.)[/ref]

    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

    com


    Kimmo Guest

Similar Threads

  1. CF Image Manipulation?
    By q6z4k in forum Coldfusion - Getting Started
    Replies: 4
    Last Post: January 18th, 06:05 PM
  2. Image Manipulation in Dreamweaver MX
    By collectauthentics in forum Dreamweaver AppDev
    Replies: 3
    Last Post: March 8th, 12:12 PM
  3. Image upload and manipulation
    By Virgil Green in forum PHP Development
    Replies: 1
    Last Post: October 1st, 10:02 PM
  4. Advanced image manipulation...
    By MS in forum ASP.NET General
    Replies: 3
    Last Post: August 27th, 04:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139