Send images in OssnMessages Download 2.1

5.0
Breton Rafael [redcrested.net] 3 years ago

An improvement on OssnMessages component to allow the user to attach images. Images also appear properly into OssnChat component, but isn't possible (yet) send images through this component.

If FancyBox component is enabled, images can be open in fullscreen mode.

Disclaimer

OSSN message system has 2 components. The OssnMessages is used in mobile version and OssnChat is the small chatbox at bottom of the page. At this version, this component only works with OssnMessage. Maybe someone here can help me to develop this part of the component :-)

Screenshots

Screenshot of OssnMessages component
Screenshot of OssnMessages component

Screenshot of OssnChat component
Screenshot of OssnChat component

How to support

If you want to help me to make more components, click on the button down bellow and buy me a coffee. It's up to you how much coffee I'll drink :-)

Changes

  • Version 2.1
    -Fixed JS error, found by Michael Zülsdorff
  • Version 2.0
    -Added desandro/imagesloaded JS file and other stuffs to fix scroll down page on load don't work propperly issue
    -Added code to delete file when user delete message. Files from deleted messages will keep into server. Sorry
    -Added code to delete file if user leave or reload page. Working in Chrome, Firefox, Edge.
    -Added button to delete an image before send. If user select another image, the old is deleted too.
    -JS file splited in two, to not inflate head section.
    -Before upload is complete, send button is disabled
    -Added TESTS.md, with test sequence used on this version
    -Images now are stored in OSSN_DATA/messages/photos/{user id} folder. Sorry for don't do this in previous versions ( Issue #1 )
    -When user is deleted, folder and files are removed too.
  • Version 1.2.1
    -Add credits to Open Social Website Core Team and OpenTeknik LLC for code used
    -Improved friendly name of component. "Allow to send images in OssnMessages" doesn't sound good to me :-)
  • Version 1.2
    -Fixed error when disable OssnMessage component, found by Michael Zülsdorff
    -Fixed warning log entry when selecting an image, found by Michael Zülsdorff
    -Add translation in Spanish. Thanks, (Hugo Cuellar)[https://github.com/Erassus]
  • Version 1.1
    -Fixed cache. Tested in both scenarios (cache on and off). Thanks again @Tamás
    -Fixed path, after Arsalam suggestion. However images sent using version 1.0 of component wont appear anymore. It's necessarily an issue to fix?
    -Fixed notification message sent/received image
  • Version 1.0
    -First release, with few tests. Use in production by your own risk.
Comments
Hungarian Tamás Varga Replied 3 years ago

Thank you Rafael.

Breton Rafael [redcrested.net] Replied 3 years ago

@Tamás

Thanks for feedback. When cache is enabled, the same as you described occured. I'm tryng to fix this.

Breton Rafael [redcrested.net] Replied 3 years ago

@Arsalan

Thanks for feedback and sugestion.

I used as base to develop the component OssnComments code. There, images are stored on tmp (https://github.com/opensource-socialnetwork/opensource-socialnetwork/blob/f3e2eb5e93bad9c13c718d958a1619de3ab45b0b/components/OssnComments/ossn_com.php#L489). But I'll change the path ASAP

Erase a image when user deletes a message its a gap to be filled.

Hungarian Tamás Varga Replied 3 years ago

The photo icon appears, I select the photo, it seems to send it to the chat partner. There is no message after that I sent the photo, no photo. OSSN 6.1

Indonesian Arsalan Shah Replied 3 years ago

Good but one thing is you should not store those static files in

> ossn_get_userdata("tmp/photos/");

This is temporary folder and all photos may lost!

Maybe you can create new folder ossn_get_userdata("messages/photos/")

Things may become difficult for you in case message item deleted and the image file still exists :)

Component

Developer: Rafael
License ossnv4
Type: Communication
Requires Ossn Version : 6.1
Latest Version: 2.1
Last Updated 2 years ago
Repository Url View Repository

Versions