Announcement

Collapse
No announcement yet.

Display image from a variable

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Last edited by stephanw; 08-23-2014, 07:26 AM.

  • #2
    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'>";
    }
    Last edited by Ronyan Alves; 08-28-2014, 04:10 PM.
    --
    ScriptCase Team

    Comment


    • #3
      Originally posted by stephanw View Post
      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
      Let us know if your problem was solved.
      Best regards,
      Carlos Lacerda.
      ScriptCase Commercial Manager.

      Skype: carlos.lacerda82
      Email: carlos@scriptcase.net
      Visit our Blog: http://www.scriptcase.net/blog/
      Visit out fan page: http://www.facebook.com/Scriptcase

      Comment


      • #4
        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/show...iving-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

        Comment


        • #5
          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

          Comment


          • #6
            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

            Comment

            Working...
            X