From: Joshua L. <Jos...@ip...> - 2000-08-10 18:48:41
|
Thank you all for your help...I now have it all figured out... Thanks -Josh -----Original Message----- From: Mark Wilcox [mailto:mew...@un...] Sent: Thursday, August 10, 2000 11:34 AM To: Joshua Lavalleur Cc: 'jon...@le...'; Perl-Ldap-Dev (E-mail) Subject: RE: Pictures From LDAP... What Graham means is that your question is not how to use LDAP and the Web together, but rather, you're question really is now "How do you print out an image from a CGI", which any CGI 101 website or book will tell you. However (hey Cliff add this to the FAQ :) this is a question that is probable general enough to add it for perusal later on the archives: 1) you'll 2 CGI's for this. 1 CGI to display any text LDAP data and 1 CGI to deliver binary data like images because HTTP requires you to send a content-type before you start outputting and you can't change mid-stream. 2) to print out an image it's simple. my $image; ... get image from LDAP .. print "content-type:image/jpeg\n\n" #could be image/gif or image/png depends how you encoded the image before storing in LDAP print $image; you can't print anything else but the image output. If you have more questions you can send them to me off the list. Mark On Thu, 10 Aug 2000, Joshua Lavalleur wrote: > Excuse me for being a really naive beginer when it come to cgi but I don't > quite know how to do that exactly. I tried to do what you suggested but I > had no luck what-so-ever. Could you point me in the direction of an example > piece of code?... > > -----Original Message----- > From: Jonathan Leto [mailto:jon...@le...] > Sent: Thursday, August 10, 2000 10:57 AM > To: Joshua Lavalleur > Subject: Re: Pictures From LDAP... > > > > make a cgi script that prints out the binary data, with a x-image/jpeg or > whatever > content type and do this: > > <img src=/cgi-bin/printpicfromldap.cgi?showpic=blah> > > > > Joshua Lavalleur (Jos...@ip...) was saying: > > > In that case could you point me to a web mailing list that actually has > > people that use LDAP and the web together > > > > -----Original Message----- > > From: Graham Barr [mailto:gb...@po...] > > Sent: Thursday, August 10, 2000 9:57 AM > > To: Joshua Lavalleur > > Cc: Perl-Ldap-Dev (E-mail) > > Subject: Re: Pictures From LDAP... > > > > > > On Thu, Aug 10, 2000 at 09:39:44AM -0700, Joshua Lavalleur wrote: > > > Okay I got how to get a picture from the directory server which turned > out > > > to be easy... > > > > > > Now I need to figure out how to display it in a web page. I figure I > have > > to > > > convert the binary stream somehow but I am not sure. > > > > > > I tried the following and got a lot of alien characters in my page. > > > > > > $content = $entry->get('photo'); > > > print "<img src=$content>"; > > > > the src= needs to be a url, which when that url is requested you get the > > image from the server and send it back with print $content (+ the > > appropriate headers) > > > > But this is not the place to ask web-based questions. Now you know > > how to get your content, you would be much better off asking this > > question to a web mailing list. > > > > Graham. > > > > |