This topic is locked

how I can show a photo (file uploaded) in add and edit page

10/18/2012 9:39:35 AM
PHPRunner General questions
I
igiacchi author

I'm back,

I apologize again for the inconvenience, but I am a programmer endangered species and moreover ham-fisted, for which shortly I will remove the disorder.

My version is PHPrunner 6.2

I have search in all forum some solutions but are for oldest versions of PHPrunner or for ASPrunner.

To be honest I find it hard to use the search in the forum, that definitely I'm not able to use it, but in all honesty it is not easy for me, it's always all mixed ASP and PHP, perhaps a guide for the use would make my life easy.

Let me clarify that this is not intended as a criticism, but just is my impression.

I also tried to use filters but leave long lists of all pages to be consulted.
However, my problem is to display an image visible in the list, even in the Edit and Add page, because the control is only displayed and not editable.

Have you some trick to show me?

Many thanks in advance.

C
cgphp 10/19/2012

Create a template var (http://xlinesoft.com/phprunner/docs/smarty_templates.htm) in the Visual Editor

of the Add or Edit page and assign it a value (your image) in the "Before display" event.

I
igiacchi author 10/20/2012



Create a template var (http://xlinesoft.com/phprunner/docs/smarty_templates.htm) in the Visual Editor

of the Add or Edit page and assign it a value (your image) in the "Before display" event.


Hi Cristian,

many thanks,

This is the original template.
{BEGIN filename_fieldblock}<TR class="runner-row style1 runner-b-addfields">

<TD class=runner-cl></TD><TD class="runner-cc runner-cc1">

<DIV class="fieldlabel_filename {$fielddispclass_filename}">{BEGIN filename_label}Filename {END filename_label}</DIV></TD>

<TD class="runner-cc alt runner-fixedcell">

<DIV class="fieldcontrol_filename {$fielddispclass_filename}">{$filename_editcontrol}&nbsp; </DIV></TD>

<TD class="runner-cr alt"></TD></TR>{END filename_fieldblock}<TR>
This is the modified template
{BEGIN filename_fieldblock}<TR class="runner-row style1 runner-b-addfields">

<TD class=runner-cl></TD><TD class="runner-cc runner-cc1">

<DIV class="fieldlabel_filename {$fielddispclass_filename}">{BEGIN filename_label}Filename {END filename_label}</DIV></TD>

<TD class="runner-cc alt runner-fixedcell"><DIV class="fieldcontrol_filename {$fielddispclass_filename}">{$filename_editcontrol}&nbsp;

</DIV></TD>{BEGIN image_value}{$image_value}{END image_value}

<TD class="runner-cr alt"></TD></TR>{END filename_fieldblock}<TR>
In Before Display i put this only for test and run

$image_value = "CIAO";

$xt->assign("image_value",$image_value);
I tried using the image variable but don't run !

C
cgphp 10/20/2012

Remove the BEGIN and END markers. You need only the template var:

{$image_value}


In the "Before dispaly" event, enter your code:

$image_value = "CIAO";

$xt->assign("image_value",$image_value);
I
igiacchi author 10/24/2012



Remove the BEGIN and END markers. You need only the template var:

{$image_value}


In the "Before dispaly" event, enter your code:

$image_value = "CIAO";

$xt->assign("image_value",$image_value);



Hi Cristian,

I have removed the markers, an tried using the filename in Before Display but I reach an error?
$image_value = data$["filename"];

$xt->assign("image_value",$image_value);
[filename] is the field that will contain the image when I choose a new image in Add page.

C
cgphp 10/24/2012

If you want to print out the image, you can use HTML:

$image_value = '<img src="'.data$["filename"].'" alt="my image" />';

$xt->assign("image_value",$image_value);


What is the error?

I
igiacchi author 10/25/2012



If you want to print out the image, you can use HTML:

$image_value = '<img src="'.data$["filename"].'" alt="my image" />';

$xt->assign("image_value",$image_value);


What is the error?



Ciao Cristian,

This is the error that I get after the modification using your code, before was different.
Using this code I don't get any errors but I cannot see any image after I choose the image form path.

$image_value = '<img src="'.[color="#FF0000"]$data["filename"].'" alt="my image" />';
What I want is to display on the fly the image I have chosen after his selection in the Add page, if it is possible.

tnx

Ivano

C
cgphp 10/25/2012

Make sure the path to the image is correct. If you want to show the image when you select a value from a dropdown you need some AJAX code.

I
igiacchi author 10/26/2012



Make sure the path to the image is correct. If you want to show the image when you select a value from a dropdown you need some AJAX code.


Hi Cristian, the path is the standard path \files and was unchanged, the control in question id the file/image, I would like to see the image after I have choosed it.

C
cgphp 10/26/2012

Enable the multi upload feature with the "maximum number of files" option set to 1. You will see the preview of the choosen image.