-1

I have a forum with MyBB and I would like to take images posted using imgur, for a gallery plugin (if image imgur posted is in forum ID, then shows it).

Users post in the forum their images (uploaded with imgur) and then in gallery there are all recent images.

I can't upload all images on my server because I'm afraid of running out of space on the server.

I have to use Curl to take images from imgur?

1 Answer 1

0

You need to run a query over your MyBB post table to find posts whose content matches a regular expression that identifies them as "having at least one image". I don't know myBB table or field names so this is just a mock:

SELECT message
FROM `post_table` 
WHERE  LOWER(message) REGEXP '\\[img\\].*\\[/img\\]'

You can narrow it down to check the actual image link points to imgur

SELECT message 
FROM `post_table` 
WHERE  LOWER(message) REGEXP '\\[img\\]http://i\.imgur\.com.*\\[/img\\]'

From then on, and since MySQL doesn't have a way to return the matching url, you might want to use PHP to preg_match over the outcome, to build the html for your gallery.

You don't need the image content, so forget about CURL. You just need the url. Imgur fits your use case just right.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.