Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.9k views
in Plugins by

sometimes it happens that a user uploads an image and another user wants to use this image in his new post.

Problem: He has to upload the image again to put it into his post.

 

The embed plugin of NoahY considers (png|jpg|jpeg|gif|bmp) -> however, the URL of the uploaded image in q2a looks like that:

http://www.gute-mathe-fragen.de/?qa=blob&qa_blobid=13189400781078488791

 

Can somebody tell me how I should change the qa-embed-layer.php of the embed plugin to achieve parsing this blob as an image as well?

 

Line 52 of qa-embed-layer.php:

'image'=>array('(https*:\/\/[-\%_\/.a-zA-Z0-9]+\.(png|jpg|jpeg|gif|bmp))[^< ]*','<img src="$1" style="max-width:'.$w2.'px;max-height:'.$h2.'px" />','img'),

what should be the new regex??

 

Note 1: All my uploads are images! So every blobid is an image.
Note 2: I changed the CKEditor - so there is no URL field for images anymore.

 

1 Answer

+1 vote
by
I have just realized that a workaround could be to add a ".png" or ".jpg" as extension in the end of the blob URL:

http://www.gute-mathe-fragen.de/?qa=blob&qa_blobid=13189400781078488791

becomes

http://www.gute-mathe-fragen.de/?qa=blob&qa_blobid=13189400781078488791.png

and the embed plugin should detect the image.
by
How do you do this?
by
1. Filter module: http://www.question2answer.org/plugins.php
2. RegEx to add .png to the blob link
...