On Fri, April 13, 2007 8:02 pm, Børge Holen wrote: > Before mr lynch starts beating up those already dead and probably long > since > burried horses... > > Images in a database! Feh. Read the archives. > See I was just wondering, and that at times leads to late nights > I used to read the images from two different files; one watermarked > the image > and one let it throught without any hazzle. > Of course this kind of script was easy enought to get around the > watermarking, > witch I fixed with the http referer witch as follows IE don't send. I > don't > particulary like ppl who use IE (ups did I upset someone?) ;D. Using referer for anything other than logging it for "analysis" later is probably your first mistake... > However I started compressing my scripts and putting them inside one > file. > And the status is so far: > > * Query for the image object. > * Query for copyright check in case of watermarking. If no > watermarking skip > to echo > * Read the object. > * put object in a file outside webroot like /tmp. > * read both the watermark and object > * merge > * echo > > Is it possible to skip one query and still be able to read ownership > from a > table and at the same time stream the object, witch lead me to the > next > question, I can't seem to be able to make imageCreateFromJPEG handle > the > direct stream, nor that I fetch it in an array, is any of this > possible? imageCreateFromString should work on your un-watermarked image from the DB. When you need the watermark, you can load the watermark from whatever source you like (file with imagecreatefromjpeg or DB with imagecreatefromstring) You can then merge the two images (original and watermark overlay) in RAM with imagecopymerge calls, or perhaps playing with an alpha blend with imagealphablending first. Creating that tmp file and writing/reading to it is probably a pretty serious performance bottleneck that should be addressed for any kind of heavy traffic or large images. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php