A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: dynamic pictures/e-mail out of flash

  1. #1
    Ride 'em FISHY! neederofhelp's Avatar
    Join Date
    Oct 2003
    Location
    I Forgot!
    Posts
    217

    dynamic pictures/e-mail out of flash

    Hey, I know this sounds like internetvirus's question but no. I'm not him. If you remember, I'm working on my youth groups website and I'm almost done! Two more quesions:

    1) We take pictures of our meetings every week and we like to put them up on the internet. When I was exploring with dynamic pictures, I found that you can export imported pictures as outside files and when you change them, they change the pic in the flash file.
    PROBLEM: What ever size of picture I put in the folder, that's the size that appears on the flash movie? Do you know what I mean? I Don't! LOL Uh, i mean if i put in a large picture in place of the picture that i exported from the file, it takes up the rest of the screen. Anywho, my question is HOW DO I KEEP THE SIZE OF THE PICTURE CONSTANT? Like in html, you'd say img src="me.gif" width =70 height-70
    can you do something like that in 3DFA?

    2) I want a pull-down menu to select a staff's e-mail address. Then I want them to be able to type a message in right there and not have to go through Outlook or AOL or something like that. Could you guys help me with that? Thanks!

    BTW, I want to thank Bret again for all his help with transfering variables to a .txt file. I'll be sure to show you guys my final results when I'm done with the site!
    Dan

    Oops. I broke it.... again.

  2. #2
    Member
    Join Date
    Aug 2003
    Location
    The Dryer
    Posts
    61
    HOW DO I KEEP THE SIZE OF THE PICTURE CONSTANT
    Use some sort of image editor, and resize the images to the same size. Remember to keep the scale the same or your pictures will probably look funky. You could also try using the tools on the left in 3DFA...

    And for #2, you will need to use some sort of server side language like php, asp, cgi, etc... You can use a form in 3dFA, but you will need a server side file to handle the form.


  3. #3
    Ride 'em FISHY! neederofhelp's Avatar
    Join Date
    Oct 2003
    Location
    I Forgot!
    Posts
    217

    gotcha=1...not 2

    Ok The Cheat (Is that from homestarrunner.com?),

    I gotcha on number 1. I got the picture thing all great like. I don't get #2 though. I figured I'd probably have to use PHP or something but how? I have a pull-down menu that sets the e-mail who you are sending the e-mail to, then you type in the subject then your message. When you click send though, it opens up your default mail client!!! So, how exactly would i perform such a task as to send it through the internet using PHP?
    Dan

    Oops. I broke it.... again.

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    the simplesest email from PHP is this

    <?php
    $to=$_POST['to'];
    $subject=$_POST['subject'];
    $message=$_POST['message'];
    $headers="ReplyTo:".$_POST['from']."\n\r";
    $headers.="From:".$_POST['from']."\n\r";
    $success=mail($to,$subject,$message,$headers);
    ?>

    call this from 3dfa after setting the variables
    to
    from
    subject
    message

    Then in 3dfa Call Loadvariables ('thisphpfile.php','POST');

    The only tricky part is the $headers
    you have to end each one with Line feed and Carriage return which is the \n\r part
    After you call this PHP 3dfa will have had the varibale success set to true or false if successful.

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Oh and by the way you can dynamically resize an image using PHP as well. But I not going there today....

  6. #6
    Member
    Join Date
    Aug 2003
    Location
    The Dryer
    Posts
    61
    (Is that from homestarrunner.com?)
    YA

  7. #7
    Ride 'em FISHY! neederofhelp's Avatar
    Join Date
    Oct 2003
    Location
    I Forgot!
    Posts
    217
    Originally posted by blanius
    the simplesest email from PHP is this

    <?php
    $to=$_POST['to'];
    $subject=$_POST['subject'];
    $message=$_POST['message'];
    $headers="ReplyTo:".$_POST['from']."\n\r";
    $headers.="From:".$_POST['from']."\n\r";
    $success=mail($to,$subject,$message,$headers);
    ?>

    call this from 3dfa after setting the variables
    to
    from
    subject
    message

    Then in 3dfa Call Loadvariables ('thisphpfile.php','POST');
    Ok, just double checking here, that PHP will send the e-mail out through the internet? It won't open up their default mail client right? And I just make the text boxes in 3dfa with those variables?

    BTW, I scraped the dynamic picture thing, figure it's just easier to do it in HTML and pop-up the page through flash. (I love your pop-up coder bret!!!)
    Dan

    Oops. I broke it.... again.

  8. #8
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Originally posted by neederofhelp
    Ok, just double checking here, that PHP will send the e-mail out through the internet? It won't open up their default mail client right? And I just make the text boxes in 3dfa with those variables?

    BTW, I scraped the dynamic picture thing, figure it's just easier to do it in HTML and pop-up the page through flash. (I love your pop-up coder bret!!!)
    Yeah that's what it does. It uses the domains SMPT server directly.

  9. #9
    Ride 'em FISHY! neederofhelp's Avatar
    Join Date
    Oct 2003
    Location
    I Forgot!
    Posts
    217

    bret, i tried that

    Okay, I tried that and it doesn't seem to be working.

    My server does support this!
    Dan

    Oops. I broke it.... again.

  10. #10
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    Re: bret, i tried that

    Originally posted by neederofhelp
    Okay, I tried that and it doesn't seem to be working.

    My server does support this!
    Tried what the email? What error are you getting?


    BTW heres a bit of code to resize an image


    In place of your image name you use the name of this script and pass the the name of the source image and the width and height you want
    i.e. <i m g src=myresize.php?myimage.jpg,200,300> ignore the spaces needed for posting to forum
    PHP Code:
    <?php
    function setSize($old,$ow,$oh){
        
    $src=ImageCreateFromJPEG($old);
        
    $width=ImageSx($src);
        
    $height=ImageSy($src);
        
    $x=$ow;
        
    $y=$oh;
        
    $dst=ImageCopyResampled($dst,$src,0,0,0,0,$x,$y,$width,$height);
        
    ImageJPEG($dst,$old);
        
    ImageDestroy($dst)
        
    ImageDestroy($src)
    }
        
    ?>
    Last edited by blanius; 11-17-2003 at 08:31 PM.

  11. #11
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590
    Hi Folks,

    I don't know if this helps, but I couldn't get the mail part to work at first either.

    I hope my terminology is right, but it would only allow me to send e-mail to and from addresses on the domain of the PHP server. ie. bob.smith@thisserver.com could only send to other people at x.y@thisserver.com, but not to x.y@anotherserver.com.

    Apparently, there are some SMTP server parameters needed, in order to be able to send e-mail externally.

    Maybe this is the problem reported 2 messages up in the thread.

    Hope this is useful input.

    ForumNewbie
    Please note that my domain has changed to http://www.morganmultinational.com

  12. #12
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    I would assume that if that is the case it is a setting in the server's SMPT , as this is NOT a native limitation in PHP. We use basically (actual code we use is a bit more advanced)the above code on many sites without a problem.

  13. #13
    Ride 'em FISHY! neederofhelp's Avatar
    Join Date
    Oct 2003
    Location
    I Forgot!
    Posts
    217

    hohoho

    I got it, I mispelled my variable, that's all. Silly me. Ok, thanks for your help guys, the site works now! Woohoo!!!!

    :

    mmm. doughnut
    Dan

    Oops. I broke it.... again.

  14. #14
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590

    After you call this PHP 3dfa will have had the varibale success set to true or false if successful.
    I really need your help folks !!

    Whenever I try to use PHP scripts like this, (to get a variable from PHP back into the flash file), I can never manage to find the variable back within my movie.
    ie. If I use exactly this example above, I can send the mail using 'loadVariables'. Back in 3dfa, if I make an editbox to show the variable 'success' after completion, the variable success is just blank.

    The same is true if my PHP script just says:

    <?
    $success="Please let this appear in my flash movie";
    ?>


    Hence I can only conclude something is stopping my PHP talking to my swf file. I'm sure this is something ridiculously simple, so please put me out of my misery !

    What is the trick to getting my PHP variable accessible in my flash file?

    Thanks,

    Morgan.
    Please note that my domain has changed to http://www.morganmultinational.com

  15. #15
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    you have to actually have the PHP send the variable with an echo command like

    echo "&success=".$success;

  16. #16
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590

    Easy When You Know How

    Excellent Brett,

    Thanks

    Only wish I'd asked 6 months ago, when I first wondered how to do it!

    My end goal is to turn my infamous dart movie into a multiplayer game. Not far to go now.

    Thanks again,

    Morgan.
    Please note that my domain has changed to http://www.morganmultinational.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center