Search code examples
phpfacebook-graph-apiphp-gd

Php gd how to display image for each user without saving


I want a help,I created a facebook app using php gd.The program is when user open the app a image will appear.The image contains the username of the user,the profile pic and random generated nick name.Iam saving the output image to the server as resized.jpg and post that image to the users wall using facebook graph. The problem is when 2 users use the app at same time,the output varies. How to generate image to each user without saving it to the server and post to facebook. now iam using html img tag to display the image in app..


Solution

  • Answer is quite simple: your image file name must have different names per user. If you have user id in $uid variable,why don't you save target file as:

    imagejpeg( $rImg, "resized".$uid.".jpg" );
    

    This way you'll have different images per user.