Zejom Posted July 14, 2008 Share Posted July 14, 2008 Generating images using the GD2 library is very slow.. is there a DirectX extension for PHP? Or at least a faster way then with GD2? Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/ Share on other sites More sharing options...
MasterACE14 Posted July 14, 2008 Share Posted July 14, 2008 Direct X in PHP? I don't think so.... Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-589186 Share on other sites More sharing options...
rioheuv Posted July 14, 2008 Share Posted July 14, 2008 Or at least a faster way then with GD2? i would REALLY like to know this to! Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-589211 Share on other sites More sharing options...
rioheuv Posted July 14, 2008 Share Posted July 14, 2008 anyone got a clue??? Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-589272 Share on other sites More sharing options...
cooldude832 Posted July 14, 2008 Share Posted July 14, 2008 what are u generating that is so dense you need to render it with dx? Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-589274 Share on other sites More sharing options...
.josh Posted July 14, 2008 Share Posted July 14, 2008 no. Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-589302 Share on other sites More sharing options...
unsider Posted July 14, 2008 Share Posted July 14, 2008 what are u generating that is so dense you need to render it with dx? That's a good question. These guys make complex 3D captchas and use PHP+GDLib, and it works out just fine. http://www.ocr-research.org.ua/index.html Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-589304 Share on other sites More sharing options...
tibberous Posted July 14, 2008 Share Posted July 14, 2008 Nope. DirectX only works on Windows, and isn't even remotely pat of PHP. DirectX is also more geared towards real-time graphics acceleration, not at creating static 2d images. If you *really* wanted to use DirectX, the easiest way I can think of would be to setup 2003 server with PHP, then create your image generating program in a language that supports DirectX, the communicate back and forth with it with PHP / databases. And yeah, what images are you creating? Are you sure it is GD2 that is slow, and not just your server or your download time? I doubt DirectX would be any faster, since not only are you going to have to write the whole surface as a bitmap, and then convert that to a web format, your going to have to initalize DirectX... DirectX also isn't going to just let you run concurant instances without screwing up either. Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-589306 Share on other sites More sharing options...
.josh Posted July 14, 2008 Share Posted July 14, 2008 what are u generating that is so dense you need to render it with dx? That's a good question. These guys make complex 3D captchas and use PHP+GDLib, and it works out just fine. http://www.ocr-research.org.ua/index.html ooh pretty Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-589314 Share on other sites More sharing options...
rioheuv Posted July 14, 2008 Share Posted July 14, 2008 because the gd library has practically nothing except a function for writing 1 pixel and a time.. do you know how many times that has to be called in a loop to make a decent sized (E.G. 1680x1050) image? ya.. the function call overhead alone kind of kills it.. not to mention that php isnt a graphics api, so actually, you know, making an image.. ya.. really slow (unless it's tiny) so if anyone knows of a decent image library for php, please post it, thanks its okay if its windows only(needs wine) Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-589351 Share on other sites More sharing options...
.josh Posted July 14, 2008 Share Posted July 14, 2008 I don't think anybody is really arguing that the GD library is very "limited;" the real point we're trying to make is that php was not really designed for graphic application. It's a server side language, used for interacting with databases and files and producing dynamic output. Are there other miscellaneous and creative uses for PHP? Sure. But that's not it's primary function. And when you think about it, all graphic application functions boil down to writing things 1 pixel at a time. Other languages or engines just make it easier for you. They give you the programmer extra functions to say, draw a line starting from x1,y1 to x2,y2. But internally, it's really no different than you having made some loops and conditions to print (or not print) it pixel by pixel. And they also do it a lot faster because they are designed to make use of lots of RAM and graphics cards, etc.. on a computer more suited for graphic application. A server is not the same as some random Joe's computer. Well I mean, it's a computer, but it doesn't need things like graphics cards. So you see, it's not really php's fault. It just doesn't have prefab functions to make life easier for you, even though those prefab functions don't really do anything that php can't. It's more the environment it's being run in. The bottom line is that if you want to do something with heavy graphics, you're going to have to use a more "traditional" language like c++, vb, java, delphi, etc... I mean hell, if you're really bent on doing it with php, you could write your own extension for it. Hell, you can even make it interact with directX or <insertsomegraphicsenginehere>. But like I said, it's not really php that's the culprit here, it's the fact that it's being run on a server. Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-589696 Share on other sites More sharing options...
tibberous Posted July 15, 2008 Share Posted July 15, 2008 If you want something better than GD, look at Image Magick, it doesn't a ton of awesome stuff, in the same way that cat | grep does a lot of awesome stuff... Quote Link to comment https://forums.phpfreaks.com/topic/114587-directx/#findComment-590087 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.