views:

18

answers:

1

I have a soap web service which accepts file attachments, these I process on the server and push as a base 64 encoded file.

What I want to do is create some test images, pdfs, text files, word docs, etc that are increasingly large.

For example:

Create a set of images that are 10 KB, 15 KB, 20 KB, ... N KB.
Create a set of pdfs that are 10 KB, 15 KB, 20 KB, ... N KB.

etc.. for various file types.

Anyone know a slick way of doing this?

(Not even sure how to tag this question as the solution could be in many languages so I marked it as scripting.)

+2  A: 

Not sure about pdfs, but for images and uncompressed bitmap is pretty easy to generate with a set size. A 24bit bitmap is 3*WIDTH*HEIGHT Bytes plus the header which IRRC is usually 54 or 52 Bytes. Perhaps GD could generate them for you in PHP? I'm not sure about it as I ave only creates PNGs and JPEGs with it, but I imagine it should be possible.

From there you just need an algorithm that calculates the image dimensions and number of images for each test.

DrDipshit
`libgd` is another good option.
Dave Jarvis