Using C or C++ library for server side rendering of images

I want to build a web application. Here's more or less what it will do:

1. Allow a user to select some info from a web page
2. send this to the server
3. based on this the server renders an image via a C library
4. sends back to client

It can be  Windows only - so we can use IIS

There's a few ways to go with this. PHP with SWIG binding to the C lib. An ASP component. Ch CGI binding to the C lib via the Ch SDK and the list could go on.

I know c++ and PHP best although I can also work in VB and ASP and other stuff too.

I need some architectural suggestions that solve binding the web service (PHP, ASP or whatever)  to the C library in an efficient way, and in a way I can get up and running quickly without too much weird stuff.

Looking for the best, clearest suggest and way forward - an example VC project would be great

further questions welcome.


Who is Participating?
Why would you use an ASP component if you want to use PHP ? It's always a good idea to stick with the languages you know.

Have you thought about just using CGI ? Make a CGI script in C that calls your library (very straightforward), and then forward the requests to the CGI script.

If you want to use PHP, then the best way would be to write an extension to PHP, and call the library from that. Here is an introduction to writing PHP extensions if you want to use them :

What kind of image based on what data do you want to create?
Do you know that you can generate images with PHP :

? That's by far the simplest solution, especially since you already know PHP. And with this solution, you don't have to use C++.
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

_farazAuthor Commented:
The C library is my own and its generating a 3D image with OpenGL and several Gigabytes of data - the viewpoint is selected by the client and sent to the server.

Obviously the image has to be generated on the server rather than streaming the data down.

_farazAuthor Commented:
So the key here is not the generation of the image, which has to be done in the C lib - the key is 1. how to interface this to a server-side web technology, 2. what are the benefits of the various options and 3. some suggestion of the most suitable solution ie if you think I should use an ASP component, please say why?

Thanks for your comments so far! Look forward to your suggestions
_farazAuthor Commented:
Thanks Infinity

I just want to use the best solution and one which will be easy to deploy. I know enough ASP to work with it, but I agree that sticking to the technology you know best is usually the best way.  I'll take a look at your suggestion of writing a PHP extension over the next few days.

Still welcome any further suggestions.

Note that the gd library I mentioned earlier ( is also an extension to PHP, and yours will most likely be very similar (except that it will call your library).
_farazAuthor Commented:
thanks for all your feedback, I've been side tracked onto something else at the moment but will respond next week.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.