How to insert image into form and save link into database along with text

Hi guys,

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.

How to do that?

Thank you,

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.


But what PHP function that do something like that. It seems only the Wordpress community can do something like this, base on my google research. :frowning:

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.

All right,
That gives the clue how it would work.
I’ll figure out the code.



This is how to do it: Insert <img> tag into Textarea

It has nothing to do with PHP, LOL.

I’m going in the wrong direction.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.