Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Photo from device #7

Open
pdestefanis opened this issue Sep 30, 2009 · 9 comments
Open

Add Photo from device #7

pdestefanis opened this issue Sep 30, 2009 · 9 comments

Comments

@pdestefanis
Copy link
Collaborator

I have noticed that in the last build the capacity to take a picture with the device and add it to the event has been replaced with the "add link to picture". Can we have that functionality back?

@dalezak
Copy link
Collaborator

dalezak commented Nov 22, 2009

Pablo, I believe the API only supports adding url for photo for existing incidents:

http://wiki.ushahidi.com/doku.php?id=ushahidi_api#post_methods

If the API supports uploading photos for existing incidents, I can make changes to the client to allow this functionality....

@dalezak
Copy link
Collaborator

dalezak commented Nov 23, 2009

Just confirmed with David, the API currently does not support uploading new photo, to an existing incident, although this functionality is in the backlog.

In the meantime, a work-around, is to upload new photo to 3rd party service, and then link that photo url to existing incident.

@pdestefanis
Copy link
Collaborator Author

Not sure, see the comment "Note Post data needs to be formatted as multipart/form-data because of the image upload. Its very important".
It seems to me that if you use the "tagphoto" POST task, then yes, you are supposed to provide a path, but if you add the photo inside a "report" POST task.
Oops, just saw that you have checked with David... Mmmmhh... I will challenge his assertion, as in the api.php I see this:

[...] line 746
// c. Photos
if( !empty($post->incident_photo)){
$filenames = upload::save('incident_photo');
$i = 1;
foreach ($filenames as $filename) {
$new_filename = $incident->id . "" . $i . "" . time();

                    // Resize original file... make sure its max 408px wide
                    Image::factory($filename)->resize(408,248,Image::AUTO)
                        ->save(Kohana::config('upload.directory', TRUE) . 
                        $new_filename . ".jpg");

                    // Create thumbnail
                    Image::factory($filename)->resize(70,41,Image::HEIGHT)
                        ->save(Kohana::config('upload.directory', TRUE) . 
                        $new_filename . "_t.jpg");

                    // Remove the temporary file
                    unlink($filename);

                    // Save to DB
                    $photo = new Media_Model();
                    $photo->location_id = $location->id;
                    $photo->incident_id = $incident->id;
                    $photo->media_type = 1; // Images
                    $photo->media_link = $new_filename . ".jpg";
                    $photo->media_thumb = $new_filename . "_t.jpg";
                    $photo->media_date = date("Y-m-d H:i:s",time());
                    $photo->save();
                    $i++;
                }
            }   

That's from when you try to add a report through the API.

No biggie anyway, we can backlog this for a while. I've just thrown this to the list, we'll see if anyone replies.

Priority Low/Med

@pdestefanis
Copy link
Collaborator Author

Also, when adding a picture (after the shutter, after pressing Save) and error comes up: “Value does not fall iwthin the expected range”.

@dalezak
Copy link
Collaborator

dalezak commented Dec 8, 2009

Pablo, does this happen if you've specified an Image Size in Settings?

@dalezak
Copy link
Collaborator

dalezak commented Dec 9, 2009

The CameraCaptureDialog has a Resolution property, which allows you to specify a Size. However, every vendor supports different resolutions. I'll try to do a Registry lookup to check for supported values at

HKLM\SOFTWARE\Microsoft\Pictures\Camera\OEM\PictureResolution

If this doesn't work, another option is to take the photo at default resolution, and then manually resize the using graphics library...

@dalezak
Copy link
Collaborator

dalezak commented Dec 9, 2009

Looks like detecting supported photo resolutions via registry is somewhat of a lost cause, appears different vendors like HTC store in different locations.

So, as an alternative, I've implemented manually resizing the photo after it's taken, should do the trick for the time being....

@pdestefanis
Copy link
Collaborator Author

don't worry, we can do this by selecting the resolution on each phone, We still run the risk of someone trying to upload a house, but it's ok

@pdestefanis
Copy link
Collaborator Author

Let's rehash this one.
We know that we can send pictures, and we agreed that we will try to set the resolution, but in the end it will be up to the end user.
Now, the API seems to be able to accept pictures, but for some reason they are not being saved. Let's continue from there, being able to add pictures from the field will be a very useful and visible feature, and key for documentation of incidents (in this and other projects)

Priority=High

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants