I want to put an image directly into a post like in wordpress post and this forum’s thread (like when you hit Ctrl + G) and the image should appear on the post or thread.
Any clue how to do that? I search on Google and the return results are only how to upload image and insert into database.
I know how to do that and how to make photo album. I want to pull those photos into a post like you see on every news site that has photos in a post.
At some point the post or thread needs to know there is an image to use.
The way I would probably do it is when the image is uploaded it is named in some relation to the post. Then in all your posts I would put some php code that looks for an image related to the post. If the image is found it is displayed otherwise nothing is shown.
You would have something like this; I an unable to write the code at the moment.
Save your thread with say a name like: 270715.php
Upload your image and call it: 270715.jpg
In your thread post you would need to drop into php
Get the thread title from the url - there is a php function for this but you may have to use explde to get what you want as well.
Save that into a variable say $thread=title - in this case 270715
add the .jpg to the end of $title
if file_exists($title){ echo “”;} - may want to add a div or css styling here as well $title is missing but the forum keeps removing it and I do not have time to sort it.
end the php code - if the image does not exist nothing will happen.