Send images in OssnMessages Download 2.1

5.0
Breton Rafael Amorim 6 months 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

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
German Michael Zülsdorff Replied 6 months ago

just checked 1.2 from Github:
warning is still there (line 26 now)
happening right after imagesinmessage/attachment call
but it's a little late here ... :) (00:30)

Breton Rafael Amorim Replied 6 months ago

I'll put all replies into one post :-)

@Hugo
Thanks for the feedback, test GIF file support, and the pull request into GitHub with translation to spanish. It will be released in version 1.2.

Added Cancel button suggestion into issues section on GitHub repo too.

@Michael
Thanks for the feedback. I added a <requires> to OssnMessages in ossn_com.xml. Also, I put a test to check if OssnMessage is active.

I put a test to try a solution to the warning in line 23 of ossn_com.php. However, I can't replicate this warning message. Can you make a test with GitHub version? I really appreciate your feedback before release the version 1.2

@Tamás and @Hugo (again, because is basically the same question)
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 :-)

cl Hugo Cuellar Replied 6 months ago

Hi, just installed v1.1 in a virtual machine for testing, no problems so far. I agree with Tamás, there's no icon in the external chatbox, but this is not a big deal and not important i think.

Also i tested with Gif Support, no errors.

Improvements suggestions:

  • Adding a delete icon to "cancel" before to send the image, what if the users select the wrong image? he can't delete the image and select another before to send the message.

enter image description here

German Michael Zülsdorff Replied 6 months ago

When selecting an image I get

PHP WARNING: 2022-03-22 08:14:41 (CET): "Undefined array key "file"" in file components/ImagesInMessage/ossn_com.php (line 23)
PHP WARNING: 2022-03-22 08:14:41 (CET): "Trying to access array offset on value of type null" in file components/ImagesInMessage/ossn_com.php (line 23)

When disabling OssnMessages I get

Error: Class "OssnMessages" not found in components/ImagesInMessage/classes/ImagesInMessage.php:12
Stack trace:
0 components/ImagesInMessage/ossn_com.php(16): require_once()
1 classes/OssnComponents.php(229): include_once('...')
2 libraries/ossn.lib.components.php(69): OssnComponents->loadComs()
3 system/start.php(39): include_once('...')
4 index.php(12): require_once('...')
5 {main}
Hungarian Tamás Varga Replied 6 months ago

Rafael: OSSN 6.1 white theme. Laptop, Chrome web browser, envelope clicking and no photo upload icon.
enter image description here

When you open menu messages, there is a photo icon.
enter image description here

Hungarian Tamás Varga Replied 6 months ago

Rafael: Photo sending is working for now, no text feedback. We test about 200 people today. Thank you very much for this opportunity.

Breton Rafael Amorim Replied 6 months ago

In GitHub I fixed these two issues (cache and path). However I finded in notification a message like [image=ME95bis5L0p instead a friendly message.

I'll try to fix this tomorrow and after that, send a new version.

Hungarian Tamás Varga Replied 6 months ago

Thank you Rafael.

Breton Rafael Amorim Replied 6 months ago

@Tamás

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

Breton Rafael Amorim Replied 6 months 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.

Component

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

Versions