Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.