Display image from a variable

Hi
i have an Image in the database in the field {Foto}. Now i want to manipulate these with php (label it) and show this labeled version again in the form.
So i do a PHP Method “labelFoto” with two parameters, $foto and $text.
The PHP Method manipulate the $image and returns the manipulated $image.

But how can i display the manipulated Image now? I try to make a new field “LabeledFoto” with datatype image(Database) or image(File) and call the PHP Method like this:

{LabeledFoto} = labelFoto({Foto},“My Label”);

in the onload section of the form. But when i generate, i get an error, that the multiupload section not configured correctly and the LabeledFoto Field is not show.

Thank’s for your help and have a nice Weekend.
Steve

Hello Mr,

You can create a label field.
Use the sc_lookup() to recover the column with the image value ( binary ).
And use a php code to convert the binary value to pixel value, like that:

$varSQL = “SELECT columnImg FROM tableImg”;
sc_lookup(rs,$varSQL);

if (isset({rs[0][0]})) {
	$varImg=base64_encode({rs[0][0]});
	{LabelField} = "<img border=0 height='155px' src='data:image/png;base64,$varImg'>";
    }

[QUOTE=stephanw;26141]Hi
i have an Image in the database in the field {Foto}. Now i want to manipulate these with php (label it) and show this labeled version again in the form.
So i do a PHP Method “labelFoto” with two parameters, $foto and $text.
The PHP Method manipulate the $image and returns the manipulated $image.

But how can i display the manipulated Image now? I try to make a new field “LabeledFoto” with datatype image(Database) or image(File) and call the PHP Method like this:

{LabeledFoto} = labelFoto({Foto},“My Label”);

in the onload section of the form. But when i generate, i get an error, that the multiupload section not configured correctly and the LabeledFoto Field is not show.

Thank’s for your help and have a nice Weekend.
Steve[/QUOTE]

Let us know if your problem was solved.

Ronyan, great solution!

since you have experience in the internal SC paths, could you have a look please at this post? still no luck about it, perhaps you can help (thankfully)

http://www.scriptcase.net/forum/showthread.php?6854-sending-email-with-image-attachment-driving-me-crazy

one more thing, since you are from the direct team of SC, is there any “working” way to limit the size of the uploaded file of each file for example? the one under Application > upload size does not work, even put number 1 (assuming it is by byte, kb, mb…etc not clear) but still allowing to upload any size! changing the whole php.ini for the site/project just for one field is not practice as well, what you think?

Mike

Hello Ronyan and Carlos
sorry, but the subscription in the forum, that send me emails seems not to work. I didn’t realize that you answer me. The solution from Ronyan works fine. I now can take the image from the db, put a label on it and display it. Now i search a way to integrate imagick… but i will look the forum and google a little. I don’t like this gd stuff very much.

Have a nice day and thank’s for your support
Steve

stephanw, for the forums reply email notifications, you can chose to have notifications when you reply to any thread (using advanced reply screen)

or adjust your subscriptions default settings, from settings > Default Thread Subscription Mode to whatever suites you

Mike