Looking for a way to store temporary images

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

Actually I think where the confusion is coming from is this: 10 options with 10 choices means 10 rows and 10 columns which on the surface does seem to be 100 but the 100 selectable objects is not what is of interest; the important thing is the number of possible outcomes and that certainly is 10 billion.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

oh ok... I understand that.
User avatar
Trenchant
Forum Contributor
Posts: 291
Joined: Mon Nov 29, 2004 6:04 pm
Location: Web Dummy IS

Post by Trenchant »

bokehman wrote:
Web Dummy wrote:Would creating the image every time the user loads the page still be resourseful? There will be two views of a users car, the front and the side.
Lets say you had 10 features with 10 choices in each; that is 10^10 or put another way 10 billion combinations. Add a few more choices and possibilites and you are talking an infinite number of images. Caching is just going to fill your hard drive with images that will probably only ever be requested once.

Storing the image in the session would work though and if you need code for this I'd be happy to help you out.

If though they already had downloaded the images of the parts to local in order to choose them my method above should work fine.
If you had an example of storing images in a session that would be great. I've never seen an example on it before.
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

Write the image to the session:

Code: Select all

// create the image here with GD... if 
// you don't know how I can help you

// Save it to the session array
session_start();
ob_start();
imagejpeg($resource);
$_SESSION['composite_image'] = ob_get_clean();
Read the image from the session to the browser:

Code: Select all

session_start();
header('Content-Type: image/jpeg');
echo $_SESSION['composite_image'];
Post Reply