frio80 Posted April 29, 2008 Share Posted April 29, 2008 Hello all, Two part question really... I am designing a system that does two important tasks: 1) colorizes (using any color in the spectrum) white-colored shapes using the GD library 2) Adds a pattern to white-color shapes using the Image Magic library. Example. 1. I have a circle; 2. I can click on the color red and the circle changes color to red. 3. I now click on an camoflauge pattern and the circle now changes to a camoflauge color. My question is, which process is more efficient? A) Create the resulting image as a file and save it to the filesystem. Then simply check if that file exists and display it when a user calls that color. (Con: The file system could literally have millions of files.) B) Do everything on the fly? Use GD and ImageMagick to simply produce the colorized/patterned images on the fly when needed. (Con: Performance is 1,000,000 people access this functionality at once) Please keep in mind that simply changing colors using CSS is not an option AND the site will have excess of 100,000 people on at a time. Thanks a bunch! Link to comment https://forums.phpfreaks.com/topic/103480-performance-cost-of-using-php-with-gd-or-imagemagick/ Share on other sites More sharing options...
corbin Posted April 30, 2008 Share Posted April 30, 2008 Hrmmm let's see.... 255 R/G/B so.... 255^3 = 16581375 * number of shapes is atleast 16581375.... That would be quite a bit of files. That could be slow finding files in the long run, and the size could grow quite large too. But! The GD library (I've never used ImageMagik personally) can become quite resource intensive, so with 1,000,000 concurrent requests (no offense but errr... keep dreaming ;p). I'm personally not sure what stress 1 mil files would put on a filesystem, so I'll let someone else elaborate on that.... (Also, couldn't you do set colors? Red, green, blue... so on?) Link to comment https://forums.phpfreaks.com/topic/103480-performance-cost-of-using-php-with-gd-or-imagemagick/#findComment-529956 Share on other sites More sharing options...
Fadion Posted April 30, 2008 Share Posted April 30, 2008 The GD library (I've never used ImageMagik personally) can become quite resource intensive, so with 1,000,000 concurrent requests (no offense but errr... keep dreaming ;p). haha probably he works for yahoo. Anyway on the real deal. Saving every possible combination (or at least the most used) would be a no-brain solution. What would be the purpose of programming it then? Even generating them on the fly for such a traffic would be awful; imagine 1.000 ppl playing on it, changing shapes, colors and patterns every nanosecond (ppl are really crazy these days ). What i can think is a not real time solution. What i mean, is that the user selects some drop downs with colors and shapes, submits the form and after being processed the image is displayed. Surely thats not as fancy as it has to be, but definitely is way more resource consuming. Link to comment https://forums.phpfreaks.com/topic/103480-performance-cost-of-using-php-with-gd-or-imagemagick/#findComment-529964 Share on other sites More sharing options...
frio80 Posted April 30, 2008 Author Share Posted April 30, 2008 @corbin - Currently, we do have a set number of colors to choose from but now the client wants a color wheels of sorts. Thanks for the reply guys. Correct me if I'm wrong but storage is cheaper than processor processor, and I have to think that simply limited the color choices and storing the files is the way to go here. Link to comment https://forums.phpfreaks.com/topic/103480-performance-cost-of-using-php-with-gd-or-imagemagick/#findComment-530314 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.