As long as preventing users to download a picture you display, my .02Eu opinion is that is is a fruitless task. A determined user will _always_ find a way to store the picture you send him. After all, you do send data to him, therefore the data can be manipulated at will:-)
As far as some code to do it, see attached souce. In the attached source, modify directories as needed. Invoke with : php -q gif2function.php > test.php Then point your browser to test.php. warning: Select a dir with few images. If yopu want to know what happens when you overdo it, goto <URL:http://helios.mm.di.uoa.gr/~rouvas/giflib.php> to see what happened to me! tested only on linux. Kevin Stone wrote: > > Huh.. hmm.. maybe this is possible after all. I'll have to test that > out when I get home. If it works it could sure save me a headache or > two. > > By the way most counters/trackers that I've seen are just simple > javascripts which gather the browser information then request a tiny > image from the server with the information in the URL string. This all > goes into the server's standard log file. Then to count the hit the > server just reads the log file and parses out the values in the URL > string. But I guess it's the same basic principle. > > -Kevin > > -----Original Message----- > From: Justin French [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, March 26, 2002 5:24 PM > To: php > Subject: Re: [PHP] Loading Images > > Ummmm, is that correct? > > I thought (although never tried) that you could reference an image as > > <IMG SRC="image.php?id=3"> or simular, in which case the headers and > everything else CAN be sent in the image tag, which is embeded in a HTML > page -- isn't that how they do counters etc etc?? > > At the moment, I'm just storing my images in my file system, and storing > the > URLs in my database (as discussed by someone else in this thread), which > works fine, as long as nobody deletes the image without deleting the URL > from the DB. > > On the topic of preventing users from saving images, the attempts are > futile, because they can also just look at your source to DL the image > from > it's URL. > > One thing I have seen work instead of disabling right-click is to have a > clear layer (DIV) above the whole page, which (for me) prevents me from > selecting text + images from below. Although I don't know how reliable > this > is. > > Justin French > --------------------- > http://indent.com.au > http://soundpimps.com > --------------------- > > on 27/03/02 10:16 AM, Kevin Stone ([EMAIL PROTECTED]) wrote: > > > It is quite easy to store images in a database and display them on the > > screen. You can find tutorials about this online (sorry I don't have > > any direct links). There are also numerous FREE scripts pre-written > > that you can integrate into your site, or use to learn how to do this > > yourself. > > > > There is a catch however... and that is you will not be able to > display > > anything else along with those images because special content headers > > must be sent to let the browser know what kind of data it's receiving. > > Is it a JPEG, GIF or PNG? If the headers are not sent, or the wrong > > headers are sent, the image will either not display or the user will > see > > endless rows of junk text spewed onto the screen (the binary data in > > ASCII form!!). > > > > So this method will only work if you want to display the images in a > > frame, one at a time, and by them selves. You won't be able to > > intermingle HTML so forget about doing dynamic menus with this method. > > > > The way these dynamic sites work is by storing the paths to each image > > in the database rather than the images themselves... so you're back to > > the file system solution. > > > > Anyway I hope this helps answer some of the questions you were having > > about this method. :) > > > > -Kevin > > > > -----Original Message----- > > From: Omland Christopher m [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, March 26, 2002 2:45 PM > > To: [EMAIL PROTECTED] > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP] Loading Images > > > > I wasn't so much concearned about security of users grabbin pics. I am > > more trying to learn how these people load there menus dynamically and > > pics dynamically. Do you have any links to pages or code that describe > > how > > to make a link in the db to pics on my filesystem? > > Thanks. > > -Chris > > > > On Tue, 26 Mar 2002 [EMAIL PROTECTED] wrote: > > > >> At 26.03.2002 12:47, you wrote: > >>> > >>> I don't have any code for this, but I'm hoping someone can point me > > in the > >>> right direction. I want to load images or navigation menus > > dynamically. Is > >>> it possible to build a database of images and then use php to > display > >>> them? Or something along these lines. I know this must be possible, > >>> becuase I see sites that do something like this, and I cant seem to > > right > >>> click the image and save it. Does this make any sense? > >>> Thanks. > >>> -Chris > >> Storing images in a db is not a good idea. instead store them > >> in your filesystem an have a reference to them in your db. > >> Then you can make everything ;-) > >> > >> Even there´s no real security for grabbing pics. If your client can > > see them, > >> they are on his/her machine. To prevent the right-click, you have to > > use > >> JavaScript, but that only works, if the user has it switched on. > >> A little more secure is putting the pics in flash-movies. But I think > > there are > >> already programs out, which allow to extract pictures and > componenets. > >> HTH Oliver > >>
<?php /* Modified by [EMAIL PROTECTED], June 200 May 10, 2000. Written and tested on PHP 4.0 RC1 (mod_php) Linux/Apache. Tried on PHP 3.0.14 Win2000/IIS 5.0 for a minute or two, it worked. ============================================================== This script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Copyright (c)2000 Pierre Marceau. You may freely use and redistribute under the terms of the GNU General Public License. -------------------------------------------------------------- gif2function - http://www.skynet.ca/~pierre/ ============================================================== This script converts gif files into PHP functions. See example.php3. Use small gif files 2 or 3 kb max. I use it for one 800 byte (0.8KB) background image file. */ //$fname[1]['name'] = '/tmp/mozilla/*.gif'; //$fname[1]['ext'] = 'gif'; //$fname[2]['name'] = '/tmp/mozilla/*.png'; //$fname[2]['ext'] = 'png'; //$fname[3]['name'] = '/tmp/mozilla/*.jpg'; //$fname[3]['ext'] = 'jpg'; $fname[1]['name'] = '../img/*.gif'; $fname[1]['ext'] = 'gif'; $fname[2]['name'] = '../img/*.png'; $fname[2]['ext'] = 'png'; $fname[3]['name'] = '../img/*.jpg'; $fname[3]['ext'] = 'jpg'; $image_registry = array(); echo '<?php'."\n"; reset($fname); while (list($fk,$fv)=each($fname)) { $far = array(); $tstr = "find ".dirname($fv['name'])." -name '".basename($fv['name'])."' -print"; $tfp = popen($tstr,"r"); while (!feof($tfp)) { $t = explode("\n",fgets($tfp,40960)); $t[0] = trim($t[0]); if (strlen($t[0]) != 0 ) $far[] = $t[0]; } pclose($tfp); reset($far); while (list($k,$v)=each($far)) { $fsize = filesize($v); if ($fsize>0) { $new_func = "\n"; $new_name = 'image_'.str_replace('=','_',base64_encode($v)); $image_registry[$v] = $new_name.'();'; $content = $fv['ext']; $fd = fopen($v,"r"); $contents = fread($fd,$fsize); fclose($fd); $b64 = base64_encode($contents); $new_func .= " function $new_name() {\n"; $new_func .= " header(\"Content-type: image/${content}\");\n"; $new_func .= " header(\"Content-length: ${fsize}\");\n"; $new_func .= " echo base64_decode(\n '"; $new_func .= chunk_split($b64,905,"'.\n '"); $new_func = ereg_replace("'.\n '$","');\n }",$new_func); $new_func .= "\n"; echo $new_func; } } } echo "\n"; echo '$image_registry=array();'."\n"; reset($image_registry); while (list($k,$v)=each($image_registry)) echo '$image_registry["'.$k.'"]="'.$v.'";'."\n"; echo 'if (!(isset($img))) {'."\n"; echo 'echo "<html><body><table border=1>";'."\n"; echo 'reset($image_registry);'."\n"; echo 'while (list($k,$v)=each($image_registry)) '."\n"; echo ' echo "<tr><td>$k</td><td><img src=\"".$PHP_SELF."?img=".base64_encode($k)."\"></tr>\n"; '."\n"; echo 'echo "</table></body></html>";'."\n"; echo "} else { \n"; echo ' $f = $image_registry[base64_decode($img)]; '."\n"; echo ' eval($f); '."\n"; echo "} \n"; echo '?>'."\n"; ?>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php