HTML5 Zone is brought to you in partnership with:

Paulund is a website dedicated to writing tutorials and code snippets about Web Development, the main subjects are PHP, Wordpress, jQuery, CSS3 and HTML5. Paul is a DZone MVB and is not an employee of DZone and has posted 124 posts at DZone. You can read more from them at their website. View Full User Profile

Fake Images Please?

01.28.2013
| 2008 views |
  • submit to reddit

When you are designing a new website you normally go through a few steps until you have the finished design.

First you will get the requirements for the design from the client, this will lead you to create a wireframe to show the client so you can make sure that it is what they hoped for.

With a wireframe you will get the basic layout of the website but won't really get the look and feel of site for this you need to start the prototyping stage. This is where you will create the site in HTML including dummy text and dummy images.

The easy thing is to include dummy text as you can use lorem ipsum. But it takes more time to create these images and make sure they are the right size for your design. Then if you want to change the sizes of these images you have to go back to your image editor and change the sizes, save the file and add these images back to your prototype page.

Fake images please

The solution is using a placeholder service like fake images please. This service allows you to create fake images at the create sizes using their API, which means you can quickly add these placeholders to your design but just typing in the image URL.

Just like the examples below.

Create An Image 300x300

The simplest form of creating an image is to pass in 1 parameter for the size of the image, this will create an image 300 x 300.

<img src="http://fakeimg.pl/300/">

Create An Image 250 x 100

You can pass in 2 sizes as the first parameter and an image will be created in this size width x height.

<img src="http://fakeimg.pl/250x100/">

Create An Image 250 x 100 With A Red Background

A second parameter can be passed to the image for the background color just like the code below will create an image 250 x 100 with a background color of red.

<img src="http://fakeimg.pl/250x100/ff0000/">

Create An Image 250 x 100 With A Red Background Black Text

A third parameter can be passed to set the color of the text to use. The below code will create an image 350 x 200 with a background color of red and a text color of background.

<img src="http://fakeimg.pl/350x200/ff0000/000">

Create An Image 350 x 200 With Text Hello

You can change the text that is added to the image by passing in a query string parameter text, the value of this will be the text that is added to the image.

<img src="http://fakeimg.pl/350x200/?text=Paulund">

Create An Image 350 x 200 With Text World

Another query string parameter of font can be passed in to change the font style, you can use Google fonts to select a new style to use on your image.

<img src="http://fakeimg.pl/350x200/?text=World&font=lobster">

Conclusion

As you can see it's very easy to create placeholder images for your prototypes and all you have to do change the image source and you can have a different sized image, you can even change the text displayed on your images.

Why not try Fake Images Places for your next prototype?

Fake Images Please



Published at DZone with permission of Paul Underwood, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: