Page 1 of 1

call image from a mySQL database

Posted: Fri Jul 08, 2005 2:35 pm
by sualocin
Hi sorry for my english..

how can I call an image from a mySQL database to a php command..

like this <span class='desc'>$last_visit</span>

THX

Posted: Fri Jul 08, 2005 2:39 pm
by Burrito
when you say 'call an image' you mean the image is stored in the DB (in a blob field or something) or the name of the image is in the db???

your bit of code is a little misleading...there's nothing image related in there?

we need a little more explanation of what you're trying to do to help you.

Posted: Fri Jul 08, 2005 2:48 pm
by sualocin
Burrito wrote:when you say 'call an image' you mean the image is stored in the DB (in a blob field or something) or the name of the image is in the db???

your bit of code is a little misleading...there's nothing image related in there?

we need a little more explanation of what you're trying to do to help you.
ok thx
sorry

I want to show the avatar in the welcome box of Invision Power Board portal (IPDynamic Lite)
the HTML code of the Welcome Box is

Code: Select all

<div class='tableborder'>
 <div class='maintitle'><{CAT_IMG}> {ibf.lang.wbox_welcome}, $name</div>
  <div class='tablepad'>
  <span class='desc'>$last_visit</span>
  <br />&middot; <a href=&quote;{ibf.script_url}act=Search&amp;CODE=getnew&quote; style='text-decoration:none'>{ibf.lang.wbox_getnewposts}</a>
  <br />&middot; <a href=&quote;{ibf.script_url}act=UserCP&quote; style='text-decoration:none'>{ibf.lang.wbox_mycontrols}</a>
  <br />&middot; <a href=&quote;javascript:buddy_pop();&quote; style='text-decoration:none'>{ibf.lang.wbox_myassistant}</a>
  <br />&middot; <a href=&quote;{ibf.script_url}act=Login&amp;CODE=03&amp;return=$return&quote; style='text-decoration:none'>{ibf.lang.wbox_logout}</a>
 </div>
</div>
<br />
<div class='tableborder'>
 <div class='maintitle'><{CAT_IMG}> <a href='{ibf.script_url}&act=Msg'>{ibf.lang.pm_title}</a></div>
 <div class='tablepad'><span class='desc'>$pm_string</span></div>
</div>
and I want to insert a row to show user avatar

in the PHP file from user profile there's

Code: Select all

$this->output .= $this->html->avatar_main( array (
              'MEMBER'               => $this->member,
              'avatar_galleries'     => $av_gals,
              'current_url_avatar'   => $url_avatar,
              'current_avatar_image' => $my_avatar,
              'current_avatar_type'  => $ibforums->lang&#1111;'av_t_'.$avatar_type],
              'current_avatar_dims'  => $this->member&#1111;'avatar_size'] == &quote;x&quote; ? &quote;&quote; : $this->member&#1111;'avatar_size'],
            )  , $formextra, $hidden_field, $this->md5_check     );
and I want to put that in the HTML code...
but I don't know why...

THX

Posted: Fri Jul 08, 2005 2:56 pm
by Burrito
from the looks of the code you posted the top part looks to be a "template" file of some sort. Most templates of that kind will not let you "inject" php directly into them. My guess is that there is some variable set somewhere that you can call by {avatar} or some such and place it wherever you want on that page.

it also looks to be storing the url of the avatar in the database and not the file itself (this is a good thing).

my suggestion: find where those vars are being set ({ibf.script_url}, {CAT_IMG} etc) and see if you can locate one for the avatar then place that in your template file...would probably be worth trying {current_url_avatar} and {url_avatar} since those are already "oulined" on the other page...

Posted: Fri Jul 08, 2005 3:06 pm
by sualocin
ok it's a template!! you're right!!!

the avatar is in mySQL database in address

ibf_members -> avatar

but I don't know if it's right to write

<img src="$ibf_members.avatar" />

Posted: Fri Jul 08, 2005 3:09 pm
by Burrito
I would try this:

Code: Select all

<img src=&quote;{ibf_members.avatar}&quote; />

Posted: Fri Jul 08, 2005 3:11 pm
by sualocin
sualocin wrote:ok it's a template!! you're right!!!

the avatar is in mySQL database in address

ibf_members -> avatar

but I don't know if it's right to write

<img src="$ibf_members.avatar" />
there are this variables in ibf_members

id name mgroup password email joined ip_address avatar