* This returns the unencoded string representation of the image */ $imgBuff = $img->getimageblob(); /** * This clears the image.jpg resource from our $img object and destroys the * object. Thus, freeing the system resources allocated for doing our image * manipulation. */ $img->clear(); /** * This creates the base64 encoded version of our unencoded string from * earlier. It is then output as an image to the page. * * Note, that in the src attribute, the image/jpeg part may change based on * the image type you're using (i.e. png, jpg etc). */ $img = base64_encode($imgBuff); echo "<img alt='Embedded Image' src='data:image/jpeg;base64,$img' />";
GoalKicker.com â&#x20AC;&#x201C; PHP Notes for Professionals
370