Hi,

>  - create an attachment
The easyest way of doing this is to install Framed admin. Framed Admin from
www.hklc.com has the needed code to attach blobs to articles and
styleelements.
>  - get it into the blob dir
What are you thinking about? Getting into a blobdir to send a blob (for
instance in an IMG tag)?
I thought of making code for serving blobs on every page, but found it to
bothersome. Instead I created a subpage with the following in "code-init" :
<?
if ($argc == 1) {
   mgd_serve_attachment($argv[0]);
   exit;
 }
?>
Basicly thats all you need to serve a blob. After getting the blob's id, you
attach it to the path and send it a long. For example: Say you got sevral
articles with a blob attached.
Heres the code I use to get the articles & display the attachments. (the
cod-init code is in the img dir).
Sorry for the cluttering part on img->size. If you want to use it, have a
look at http://marc.theaimsgroup.com/?l=midgard&m=97025763708552&w=2 and
onwards discussions in that thread. (I thought I published the whole
codelisting for the nodhtmlpickimage_attach page, I'll get back to that
later.

<?
$article = mgd_list_topic_articles_all(14,"dato",1);
// Her begynner for setningen som lager hvert artikkelelement.
 if ($article) for ($i = 0; $i < 6 && $article->fetch(); $i++) {

 if ($article) {
$topic = mgd_get_topic($article->topic);
$art = mgd_get_article($article->id);
$att = $art->listattachments();
}
 $lvar = fvar($article); // gir $lvar et innhold
?>
  <SPAN id="dato">&(article.date);: <br></SPAN>
 <SPAN id="header"> &(article.title:h);<br></SPAN>
<?
if (gettype($att) == object) for ($j = 0;$j<1 && $att->fetch();$j++) {
$mimetype = substr($att->mimetype,0,5);
if ($mimetype == "image") {
$img = mgd_get_attachment($att->id);
if ($img->size_x<150 or $img->size_y<150) {
if (strlen($img->size_y)==0) {
?>
<img src="http://&;(url);/img/&(att.id);" type="&(att.mimetype);"
alt="&(att.title);" align="right">
<?
} else {
?>
<img src="http://&;(url);/img/&(att.id);" height="&(img.size_y);"
width="&(img.size_x);" type="&(att.mimetype);" alt="&(att.title);"
align="right">
<?
}
}
}
}
?>
<SPAN id="abstract"> &(article.abstract:h);</SPAN>
<DIV align="left"><a href="&(lvar);&(article.id);.html" class="lesmer"> les
mer >&nbsp;&nbsp;</a>
<hr size="1"></DIV>
<? }
// For over
}?>
I hope I haven't doubled on Emile's stuff.


Tarjei

>  - assosiate it with an element of midgard
> (short snippets of functioncalls should be enough)
>
> Live long and prosper!
> Torben Nehmer
>
> --
> ICQ-ID           : 14148813
> WWW              : http://www.nathan-syntronics.de
> E-Mail           : [EMAIL PROTECTED]

Reply via email to