This topic is locked

Display image in view

3/8/2007 6:13:35 AM
PHPRunner General questions
buddy author

I am trying to show a preview of a label in the edit screen.
All works fine except the image. I must be missing something.
<TABLE style="BORDER-COLLAPSE: collapse" width=300 border=1>

<TBODY>

<TR>

<TD align=middle>

<P class=shade align=middle><STRONG><FONT size=1><BR>LABEL

PREVIEW<BR> <BR></FONT></STRONG></P><BR>

<P align=center><BR><BR><FONT face=Arial>{$value_Address}<BR>{$value_City},

{$value_State} {$value_Zip}<BR></P></FONT>

<P></P>

<P><FONT face=Arial

size=3><STRONG>{$value_Phone}</STRONG></FONT><BR></P>

<P> </P></TD></TR></TBODY></TABLE>
All I get is the binary on the logo rather than the image.
Help is appreciated. (I also tried {$Logo_value}

Alexey admin 3/9/2007

Buddy,
use this code to display an image:

<img src="tablenameimager.php?field=Logo&key1={$valueID}">



where tablenameis your table name and ID is a key field.

buddy author 3/9/2007

Here was the answer that worked:
<TABLE style="BORDER-COLLAPSE: collapse" width=300 border=1> <TBODY> <TR> <TD align=middle> <P class=shade align=middle><STRONG><FONT size=1><BR>LABEL PREVIEW<BR> <BR></FONT></STRONG></P><BR> <P align=center> <IMG src="TableName_imager.php?field=ImageFieldName&amp;key1={$show_key1}"> <BR><BR><FONT face=Arial>{$value_Address}<BR>{$value_City},

{$value_State} {$value_Zip}<BR></P></FONT> <P></P> <P><FONT face=Arial size=3><STRONG>{$value_Phone}</STRONG></FONT><BR></P>

<P> </P></TD></TR></TBODY></TABLE>
Thanks

buddy author 3/9/2007

One last thing.
With the above code that works, I would like to show the image if one exists, otherwise display the contents of the Customer field formatted ast 14pt Arial Bold.
Thanks in advance for the help.

J
Jane 3/9/2007

Buddy,
try to use following code:

<TABLE style="BORDER-COLLAPSE: collapse" width=300 border=1> <TBODY> <TR> <TD align=middle> <P class=shade align=middle><STRONG><FONT size=1><BR>LABEL PREVIEW<BR> <BR></FONT></STRONG></P><BR> <P align=center>

{if $value_ImageFieldName!=""}

<IMG src="TableName_imager.php?field=ImageFieldName&amp;key1={$show_key1}">

{else}{$value_Customer}{/if}

<BR><BR><FONT face=Arial>{$value_Address}<BR>{$value_City},

{$value_State} {$value_Zip}<BR></P></FONT> <P></P> <P><FONT face=Arial size=3><STRONG>{$value_Phone}</STRONG></FONT><BR></P>

<P> </P></TD></TR></TBODY></TABLE>



where Customer is your actual field name.

buddy author 3/9/2007

Buddy,

try to use following code:
where Customer is your actual field name.


Seems the if statement is erroring:
{if $value_Logo=""}{$value_Customer}{else}<IMG

src="_Labels_imager.php?field=Logo&amp;key1={$show_key1}">{/if}
Technical information Error type256 Error description: syntax error: unidentified token '=' (Smarty_Compiler.class4.php, line 1393) URLplycem.buddydigital.net/_Labels_edit.php?editid1=1 Error file/home/buddy/public_html/plycem/libs/Smarty.class4.php Error line1095 SQL queryselect `ID`, `Customer`, `Contact`, `Address`, `City`, `State`, `Zip`, `Phone`, `Logo` From `_Labels` where `_Labels`.`ID`=1

J
Jane 3/9/2007

Buddy,
here is the correct code:

{if $value_Logo==""}{$value_Customer}{else}<IMG

src="_Labels_imager.php?field=Logo&amp;key1={$show_key1}">{/if}

buddy author 3/10/2007

Buddy,

here is the correct code:


Ok, that works great for the Edit and Add Page. Still having problems with the List and View page
List Page
(This only shows the Logo value on every record, not the Customer if no logo exists.
{if $row.1Logo_value==""}<FONT face=Arial

size=3><STRONG>{$row.1Customer_value}</STRONG></FONT>{else}{$row.1Logo_value}{/if}
View Page
(This only shows the Customer value on every record, not the logo if there is one.
{if $value_Logo==""}<FONT face=Arial

size=3><STRONG>{$show_Customer}</STRONG></FONT>{else}{$show_Logo}{/if}
Thanks for your help