Hi,

It's late and I've finaly managed to get blobs working. I just wanted to say
one thing, as it has caused me 10 - 12 hours of work before I found out
where the problem was.

DO NOT LEAVE WHITESPACE OR ANYTHING BEFORE A MGD_SERVE_ATTACHMENT() call!!!
(well almost. As long as it's between php tags and doesn't echo it's ok..)

I used Emiles code, did everything right, but could not make it work. After
a lot of poking around I tried to go to the uri
(/displaypage/artID/attachmentID) and god the errormessage that a header was
allready sent before the attachment header. The problem originated from a
white-space in code-global!!!!

I hope this posting might save someone some time.

Tarjei

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: 7. september 2000 12:21
> To: [EMAIL PROTECTED]
> Subject: Re: [midgard] getting the blobs related to an article
>
>
> Tarjei Huse wrote:
>
> > I've tried a number of things to manage to get attachments.
> Basicly I've
> > added attachments through the "add image" in fadmin. But:
> It is impossible
> > to call them back! At lest it seems so.
> >
> > Does anyone have the code to get the attachments of an
> article, and display
> > the file (gif or jpeg) in the listing. THis is a listing of
> articles and
> > their abstracts, and I want to disply pitcures with the articles.
>
> I have no intimate knowledge of fadmin, but I suppose this would work:
>
> have a active page /displayarticle with content:
>
> <?
>
> if ($argc == 0) {
>   echo "No article selected" }
> else { if (! ($article = mgd_get_article($argv[0]) ) {
>   echo "No article ", $argv[0];
> } else {
> ?>
>   <H1>&(article.title);</H1>
>   &(article.abstract:f);<p>
> >?
>   $att = $article->listattachments();
>   echo "<DL>"
>   while ($att && $att->fetch()) {
>     /* test $att->mimetype here if you're not sure that all
> attachments
> are
>        images */
>     echo "<DT><IMG SRC=\"/displayarticle/", $argv[0], "/", $att->id,
> "\">";
>     echo "<DD>", $att->title;
>   }
>   echo "</DL>";
> }
>
> ?>
>
> attach a page element 'code-init' with content:
>
> <?
> if ($argc == 2) { /* display blob */
>   mgd_serve_attachment($argv[1]);
>   exit;
> }
> ?>
>
> Emile
>
> --
> This is The Midgard Project's mailing list. For more information,
> please visit the project's web site at http://www.midgard-project.org
>
> To unsubscribe the list, send an empty email message to address
> [EMAIL PROTECTED]


--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org

To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]

Reply via email to