Jump to content

[SOLVED] output image


littlepeg

Recommended Posts

If u told what u want to do then u could get some more help. A pretty simple example using the GD library:

 

$imagePath = 'myimage.jpg';
$img = imagecreatefromjpeg(); //create the image resource from the file
header('Content-type: image/jpeg'); //set the header so it outputs the image
imagejpeg($img); //output the image

 

It actually does nothing, just gets an existing image and outputs it to the browser. Look for GD at the php manual and you'll find a lot u can do with images.

Link to comment
https://forums.phpfreaks.com/topic/67516-solved-output-image/#findComment-339007
Share on other sites

Hi, I have a row of pictures (emoticons) at the top of the web page. And I want to output a story from my sql database underneath these pictures. Then I would like another row of the same pictures followed by another story from the database. Then I would like to continue repeating this sequence until all of the stories from the database are on this web page. How can I do this using php codes? I would be grateful for any help. Thank you.  :)

Link to comment
https://forums.phpfreaks.com/topic/67516-solved-output-image/#findComment-339011
Share on other sites

$connect = mysql_connect('hostname', 'username', 'password');
mysql_select_db('myDB');
$query = mysql_query("SELECT * FROM stories");
while($values = mysql_fetch_array($query)){
      echo "<img src=\"emoticons.jpg\" /><br />";
      echo $values['story'];
      echo "<br /><br />";
}
mysql_close($connect);

 

If u know some simple database handling u shouldnt have problems with what u want.

Link to comment
https://forums.phpfreaks.com/topic/67516-solved-output-image/#findComment-339014
Share on other sites

Nah the above code will output images below each other. U can use an html table for simply hanging this out:

 

echo "<table>
 <tr>
   <td><img scr=\"emoticon1.jpg\" /></td>
   <td><img scr=\"emoticon2.jpg\" /></td>
   <td><img scr=\"emoticon3.jpg\" /></td>
 </tr>
</table>";

Link to comment
https://forums.phpfreaks.com/topic/67516-solved-output-image/#findComment-339025
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.