We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Newsfeed photo upload | Forum

Diego Alex
Diego Alex Jun 3 '16
Hi, when i do a photo upload in the newsfeed the image file lost some information that i need, where is the responsible file for the upload so that I can modify it or if anyone know a better way to do it
Senior Developer Leader
Senior Developer Jun 3 '16

Hi Diego Alex!

The attachment photo in newsfeed is stored by the system base attachment plugin, you can find it in: ow_system_plugins\base\bol\attachment_service.php


Be careful with what you do in that code, remember that if you update the system, this changes are going to be overwritten.

I don´t know what information do you need or what are you planning to do with it, if you can tell me what you are trying to do, maybe i can tell you how to do it or at least send you to the right direction.

Diego Alex
Diego Alex Jun 6 '16
Hi, i want to get latitude/longitude information in the photo, so that i can geolocate it
Diego Alex
Diego Alex Jun 8 '16
Saying in a better way i am trying to upload a photo with gps data, but after the upload this information is lost. 


I'm trying to make a complete copy of the original file but i'm not finding his url

dave Leader
dave Jun 8 '16
how are you going to store that data, session? database?
Diego Alex
Diego Alex Jun 8 '16
I will store in the database
Senior Developer Leader
Senior Developer Jun 8 '16

In the file "ow_system_plugins\base\bol\attachment_service.php" search for this line:


$image = new UTIL_Image($fileInfo['tmp_name']);


This is where your metadata is lost, you can get and store the metadata if you add your code before that line.


$fileInfo['tmp_name'] is your original uploaded photo, this file is destroyed, so if you need the original file you can make a copy before the "@unlink($fileInfo['tmp_name'])" or just move it instead of unlink it ----- 


move_uploaded_file($fileInfo['tmp_name'], $myNewPath);



The Forum post is edited by Senior Developer Jun 8 '16
Senior Developer Leader
Senior Developer Jun 8 '16
I think that you know how to get the exif data from the original file and store it in the database, that's why i didn't added that information.
Diego Alex
Diego Alex Jun 8 '16
Problem solved! Thank you.
dave Leader
dave Jun 8 '16
thanks SD  for that info ;)   


Just remember Diego that any code you add to the core will be overwritten on update.  So save your changes :)

Senior Developer Leader
Senior Developer Jun 8 '16
You're welcomeI'm glad I could help :)