WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-28-2003, 02:32 PM
RonW RonW is offline
WebProWorld New Member
 

Join Date: Aug 2003
Location: Houston, Tx
Posts: 5
RonW RepRank 0
Default What program? You've seen them. Image design online

You've seen them ... those "Design your own business cards online" sites such as Vistaprint and Makeacoolcard .com's. How do they sequentially combine text and images and then present a composite image? There are even many more sites that offer this ability.

I do know Vistaprint uses its own proprietary software named VistStudio to achieve this but, are there other methods, software or programs available to achieve the same thing?

I'm wanting to do the same thing but for a different application.
Reply With Quote
  #2 (permalink)  
Old 10-29-2003, 12:49 PM
jhilgeman's Avatar
jhilgeman jhilgeman is offline
WebProWorld Member
 

Join Date: Jul 2003
Posts: 175
jhilgeman RepRank 0
Default

(This goes into programming, so I trust you're familiar a little with the basic terminology.)

Probably your best bet lies in a little library called GD. This library has all the tools inside necessary for generating new images. The TYPES/FORMATS of images it can create then depends on what other libraries are installed on the system.

For instance, if you have the libJPEG library installed on your server, then GD can use it to create JPEGs. LibPNG allows GD to create images in the PNG format, and so on...

So GD does the primary work of assembling the image, "Ok, put a red line here, put a pink dot over here, and a black box over there, and add anti-aliasing so the red line doesn't look jagged..."

... and then it spits out that image data in JPEG, PNG, etc... format. (It used to support GIF format, but that GIF format is copyrighted by Compuserve.)

So how do you control GD? Usually you can control it with a programming language like PHP or Perl. You simply have to set up PHP or Perl so that they see that GD is installed on the system, basically. If you want to get technical about it, there are components that act as middle-men between the programming language and the GD library. But if you want more details on setting all of this up, you'll have to create a separate thread for it. :)

Once the system has been set up (luckily, most hosting companies already do this for you), all you have to do is write a simple program that sends commands to GD. If you want to check to see if you have PHP and GD set up, create a file on your web server called something like info.php and just have it say:

<?
phpinfo();
?>


That simple phpinfo() function will spit out a nicely-formatted, detailed list of how PHP is set up on your server and will tell you all of its capabilities. GD's about 2/3rd's down the page - just search the page for it.

Now, assuming you have GD set up, here is a simple PHP program that creates a 468x60 banner in JPEG format. First, create a new, empty file called testimage.php. Put this inside it:

<?
// This creates a 468 by 60 canvas for you
// to work with.

$im = imagecreate(468,60);

// These next lines allocate colors that you can use.
// (It's kind've like putting little gobs of paint
// on a palette in real life, so the painter can
// dip his brush into a specific color and use it
// to paint that color.)

// You define colors by telling how much red, green,
// and blue is in the color, from 0 (none of color)
// to 255 (max color). So 0, 0, 0 would be 0 red, 0
// green, and 0 blue and would create black. On the
// other side, 255, 255, 255 would be 255 red, 255
// green, and 255 blue, which would create white.

// (NOTE: The first color you allocate will also
// automatically be the background of the image.)

$white_color = imagecolorallocate($im, 255, 255, 255);
$bright_red_color = imagecolorallocate($im, 255, 0, 0);


// This just types out the phrase "A Banner" using
// the bright red color we just allocated in the
// previous step. You CAN use any TrueType font,
// but there are also some built-in fonts, so I used
// built-in font #3. The phrase is positioned at the
// coordinates X=50 and Y=35.

imagestring ($im, 3, 50, 35, "A Banner", $bright_red_color);

// Now we have a simple image - we just tell GD to
// save it as a JPEG. If you don't specify a file
// name, GD will just spit out the data straight to
// the browser.

imagejpeg($im);

// And finally, it's good practice to free up the
// memory after the JPEG has been created. It's like
// cleaning up the kitchen after you've cooked the
// meal.

imagedestroy($im);
?>


Now, assuming everything's working correctly, you should see this:



There's a whole bunch of things you can do, though - you can create shapes, use different fonts, overlay things, resize images on-the-fly, etc... Ever since I started using GD, it's been an incredible tool.

Just for a quick overview, here's the flow of info:
1. User puts data into a form (optional)
2. Data is passed to PHP/GD script.
3. Script sends commands to GD to create image.
4. GD finishes creating image and send back image.
5. Image is displayed to user.

I hope this is a little useful - let me know if you don't understand parts of it or if you want more info on a certain area. Good luck!

- Jonathan
Reply With Quote
  #3 (permalink)  
Old 10-29-2003, 02:42 PM
redcircle's Avatar
redcircle redcircle is offline
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Grand Rapids, MI USA
Posts: 553
redcircle RepRank 0
Default

Quote:
Originally Posted by jhilgeman
... and then it spits out that image data in JPEG, PNG, etc... format. (It used to support GIF format, but that GIF format is copyrighted by Compuserve.)
Some good news for GIF format. On June 20, 2003, the LZW patent expired in the US. In 2004 (supposedly July 7th) the patent will expire in the other countries where Unisys holds it.

After the patents have run out GD will once again support gif.
Reply With Quote
  #4 (permalink)  
Old 10-29-2003, 09:45 PM
Kevnn Kevnn is offline
WebProWorld New Member
 

Join Date: Sep 2003
Location: Florida
Posts: 17
Kevnn RepRank 0
Default simple way to solve your need

VistaPrint may use a proprietary solution, but you could get the same effect using asp with CSS, you can pass your data to each page and layer it however you want. Another option, Flash, might be more fun, and provide a few options, like animated graphics to the mix. Depends on what your end use is as to what is your best solution might be.
Reply With Quote
  #5 (permalink)  
Old 10-30-2003, 05:59 AM
paulhiles's Avatar
paulhiles paulhiles is offline
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default Image design online

With any online design process, you're always going to need a speedy response on the client side. While the finished product is going to require a high quality print ready file for its production.

I used to work for ControlP PLC (in a former existence), and they developed an online business card template system, that could literally 'break apart' a PDF file into its constituent parts, and rebuild it 'on the fly'. This would all happen through a standard browser window. The client would be presented with a fairly low-res representation on screen, whilst the print-ready PDF file was being prepared in the background from fields stored dynamically.

This was a hugely expensive project, that was eventually sold off with most of the company's assets a year or two ago. Recent attempts I've seen by other competitiors have involved client side DHTML that has used text descriptions for positioning font, color, etc. These have then been outputted using Xdata files and QuarkXpress.

I think that many of the lower-end budget priced systems tend to rely on pre-defined design templates, with the user restricted to certain fields... using ColdFusion or ASP to store database info as the design is being constructed.

There has been so much interest in this area, that there is now little return on investment.. and I for one am glad I'm no longer involved! :c)

Paul
Reply With Quote
  #6 (permalink)  
Old 10-30-2003, 10:10 AM
RonW RonW is offline
WebProWorld New Member
 

Join Date: Aug 2003
Location: Houston, Tx
Posts: 5
RonW RepRank 0
Default Thanks

Thanks to all! Especially jhilgeman!

I plan to fully explore the GD Library...just now getting my feet wet but I'm a quick learner.

I've viewed many sites already who provide examples of the GD Library. I guess my "wishful find" would be an indepth example showing how many predifined images options are selected by the user and added to a specific, user selected background.

The actual application I wish to apply this to is in the area of designing your own plaque, memorial and/or headstone online. It may sound daunting or morbid but, after incidently seeing this process in action exacted by only the means of hand-written text and arrows - drawings delivered via fax, I thought there's got to be a better way. And, a way that removes most human error. Imagine a bronze casting delivered that should have had two s's. Owe! That's a lot of money to eat on a mistake.
Reply With Quote
  #7 (permalink)  
Old 10-30-2003, 12:02 PM
jhilgeman's Avatar
jhilgeman jhilgeman is offline
WebProWorld Member
 

Join Date: Jul 2003
Posts: 175
jhilgeman RepRank 0
Default

Design your own headstone online? Yeah, that's a little morbid, but I guess if people want to do it...

You should have some pre-defined limericks to rhyme with people's names or maybe offer a limerick design based on people's names and details or something:

“I’m preparing to go meet the Lord”
Said a sickly old fellow named Ford,
“To be buried at sea
Seems the best way to me
But I don’t want to go overboard”

Just make sure you don't include any pre-defined methods of death - that might be too morbid and scare some people. :)

- Jonathan
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: design, image, online, program, seen, them, youve



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Search Engine Friendly URLs by vBSEO 3.0.0