This topic is locked

How to create an embed code

6/9/2011 2:33:56 PM
PHPRunner General questions
milsimcorps author

Hi guys maybe someone can help. Here is my situation: We are a Sports League and we would like our members to be able to share their stats (live) on their own website. I am assuming that this can be done by creating embed codes for every search. Is it possible to create embed codes for each search?

Sergey Kornilov admin 6/9/2011

Most probably you need to create a separate page for this purpose (outside of PHPRunner) that accepts user id as parameters, connects to the database and returns stats as an image.
Here is how StackOverflow does it:


<img src="https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=58788&image=2&table=forumreplies"; width="208" height="58" alt="profile for Sergey Kornilov at Stack Overflow, Q&amp;A for professional and enthusiast programmers">


To generate images from PHP code you can use GD library:

http://php.net/manual/en/book.image.php
Here is some sample code:

http://www.webcheatsheet.com/php/dynamic_image_generation.php