danielebogo / dbcamera Goto Github PK
View Code? Open in Web Editor NEWDBCamera is a simple custom camera with AVFoundation
License: MIT License
DBCamera is a simple custom camera with AVFoundation
License: MIT License
If the user taps the screen to focus, is there any way to get the focus x,y position in relation to the actual image.
say image ends up being 100x100.
If user touches mid point, is there a way to get the point (50,50) in the delegate method where I process the image?
This is not an issue.
I was just wondering why you separated the container from the camera view. What are the merits of doing so?
Once go for camera roll from this it has memory leak. Please check it
The compiler is complaining that GPUImage is not installed. I am trying to run example.
Was this intentional? Do we have to download GPUImage ourselves or was it a mistake that you didn't include it?
Hi, whenever I choose a photo there's memory warning issue.
What could be the problem here?
Thanks.
Hi @danielebogo
Jack
@danielebogo
Hi! danielebogo
Thanks for the great source, it works like a charm.
however i have a litte problem : How can i support video or movie filter?
Jack
When I perform a click on a photo in collection view, I want to call a delegate in my controller to process anything at here before go to crop/filter screen. Can I do this?
For more specific, I find out in file DBCameraCollectionViewController.m, a delegate of collection view "collectionView:didSelectItemAtIndexPath", can I call my delegate function at here?
Hi, I'm having trouble using the camera on iPad. The size of the camera is quite small, how can I put it in full screen?
Thanks
Angelo
Getting this crash quite often with some test users.
Thread : Fatal Exception: NSInvalidArgumentException
3 TestApp 0x00000001000cf238 __36-[DBLibraryManager assetsEnumerator]_block_invoke (DBLibraryManager.m:117)
I don't have exact repro steps yet but it happens on Line 117 of DBLibraryManager.m.
looking at Apple docs,
"- (ALAssetRepresentation *)defaultRepresentation
Return Value
An asset representation object for the default representation.
Discussion
This method returns nil for assets from a shared photo stream that are not yet available locally. If the asset becomes available in the future, an ALAssetsLibraryChangedNotification notification is posted."
My guess is that it's probably happening to a photo stream photo not available locally when picked from library and therefore causing the nil argument crash.
adding a nil guard might be a quick fix?
if([result defaultRepresentation]){
[items addObject:[[result defaultRepresentation] url]];
assetResult = result;
}
Hi @danielebogo
I created an Apache Cordova wrapper for this project here: https://github.com/vulume/Cordova-DBCamera
Please check it out and let me know what you think. Contributions are more than welcome. Let me know if I can better accredit your work anywhere as well.
Cheers
Hello, I'm trying to call the init function with cameraSettings from Swift. Has this been done? I asked here with more details: http://stackoverflow.com/questions/24722216/obj-c-init-not-recognized-in-swift-dbcamera. Thanks!
When I click photo album icon at right bottom, console says:
2014-06-12 16:26:47.170 DBCamera[519:55778] Attempt to add read-only file at path file:///var/mobile/Media/PhotoData/Photos.sqlite?readonly_shm=1 read/write. Adding it read-only instead. This will be a hard error in the future; you must specify the NSReadOnlyPersistentStoreOption.
and the application says:
Attention: There are no images in your Library.
What can be the problem ?
Note: I'm using iOS 8
When you click on the preview layer, it shows the focus circle perfectly.
However if you drag your finger around, the circle drags around, BUT there is an offset so it's not perfectly under your finger.
I want to be able to crop by swiping my finger across the image.
The initial point will represent top-left corner of rectangle.
The final point of swipe will represent the bottom-right corner of rectangle.
I will crop out all other areas.
What is the best way to do that in your code?
What functions should I use to perform the cropping etc?
I want to save new photos taken and selected to be 'used' to the camera roll. However, if a photo is selected from the camera roll and 'used', I don't want to save a duplicate.
Is there a way to pass an identifier to the method '- (void)captureImageDidFinish:(UIImage *)image withMetadata:(NSDictionary *)metadata'
(or does it exist already in meta data?) that can identify the image as new or pulled from library?
(I know I should make a pull request for this, but I'm not familiar with localizations on Xcode and I'm afraid I will mess it up.)
I've translated the strings to Portuguese (pt-br)
/*
DBCamera.strings
DBCamera
Created by iBo on 11/02/14.
Translated by Guilherme Araújo on 29/05/14
Copyright (c) 2014 PSSD - Daniele Bogo. All rights reserved.
*/
"button.use" = "Usar foto";
"button.retake" = "Repetir";
"general.error.title" = "Atenção";
"pickerimage.nopolicy" = "Por favor, habilite as permissões para poder acessar sua Biblioteca de Fotos. Verifique suas permissões em Ajustes > Privacidade > Fotos";
"pickerimage.nophoto" = "Não há nenhuma imagem na sua biblioteca";
"pagecontrol.text" = "%i de %i";
Unfortunately, the camera control attempts to be full screen, so the tabbar is shown AND a portion of the camera is underneath it.
Is there anyway to fix that?
Hi again @danielebogo ,
I don't want to use another library for video recording and picking from album.
I only want to use your awesome UI.
When will you think to add these features to your library sir ?
If it is not a close time, I have to look another classes sadly.
I am using your camera library to take pictures and process them to a server. But I would like to be able to load in the existing photos on an iphone. I ran your example app and gave authorization to access photos, but still doesn't load anything when i click on the 'preview' button. Any suggestions?
The white icons look great, but I wish I could tint them and the labels to meet my app's standard colors. Is it in the future plans?
Right now DBCamera's interface is very hardcoded. Or else you need to build the whole interface from scratch with a custom camera.
I think it would be really clean if the DBCameraView exposed its closeButton, gridButton etc properties, so we can just hide them (set .hidden = YES) if we want, keeping the rest of the features.
Try this: open the camera, tap the screen and you'll see that the focus indicator pops right underneath your fingertip.
Now zoom in a little bit and repeat. The indicator will now be shifted down and sideways, depending on where you tap.
Hi,
I love your UI design, so I want to use it for another purpose,
In my application there is 2 buttons, one is "take a photo" , another is "pick a photo".
I'm using DBCamera for "take a photo" with photo picker icon at right bottom.
But I want to use your photo picker UI as well as in "pick a photo" action.
So, how can I open your photo picker UI directly ? I mean without opening camera first.
Great work so far.
When taking a picture only a square frame is visible suggesting the resulting image will be inside that box. But when taking the picture it is actually outside those boundaries. I would like to see an option to return the image with how it is presented in that box.
Is that hard to implement?
Regards
If cropping or filters are applied to an image by the photos.app they are not displayed by the built in camera picker.
The information is in the metadata and must be applied from the image.
The image appears in the picker as edited but once selected it is the original image.
Here is the issue on stackoverflow
http://stackoverflow.com/questions/22433321/alassetslibrary-returns-image-without-external-crop-or-other-filters
Awesome lib!
Would love it if there was a setting to specify an output/working image resolution for when full quality isn't necessary. See snapchat for example, they work with a really low resolution all the way and it makes the app really snappy.
The compiler is complaining that GPUImage is not installed. I am trying to run example.
Was this intentional? Do we have to download GPUImage ourselves or was it a mistake that you didn't include it?
The library has some problems with this kind of orientation. Could you fix it please? :(
What is stopping this lib from working on iOS 6?
I am trying to use this library, and everything works great except when I try to use the image. The delegate method is never called. Tapping the 'Use Photo' button/text after taking a picture never does anything. The button doesn't even change color like the crop and retake buttons do (i.e. doesn't highlight). Any suggestions?
I implemented the code directly from the instructions:
HomeViewController.h:
@interface HomeViewController : UIViewController
HomeViewController.m:
}
When I drag and drop in the cropping interface it frequently bounces back to the original position.
This effect is particularly noticeable when trying to drag to the borders of the image.
Just wondering if there are any plans to implement more image editing features than just a basic crop?
If there are and you are open to pull requests I've been working on a forked version of this repo that replaces the DBCameraSegueViewController with this project: CLImageEditor as it provides a lot of great image editing tools without changing the basic flow of this project.
Hey! I have some problems of screen bounds with DBCamera on iOS 6.
To fix, I've added these lines on DBCameraView.m:
(DBCameraView *) initWithCaptureSession:(AVCaptureSession *)captureSession
{
CGRect rect;
if ([[[UIDevice currentDevice] systemVersion] floatValue] <= 6.1)
{
rect = CGRectMake( 0.0f, -20.0f, [[UIScreen mainScreen] bounds].size.width, (([UIScreen mainScreen].bounds.size.height ) - 50 ));
} else {
rect = [[UIScreen mainScreen] bounds];
}
return [[self alloc] initWithFrame:rect captureSession:captureSession];
}
The image in the previewlayer doesn't seem to match the output image.
Do you have suggestions on how I can make the output image match the previewlayer (i.e. cropping before it reaches delegate method)?
Is there currently any ability to disable the open from photo gallery on the default camera view?
Or any plans to implement this feature in the future ?
Hey I might just be missing something. I've added this to my app but when I launch the camera view, i'm not seeing all the icons (cancel, switch, flash, etc). Help. Thanks!
Hi! @danielebogo
You will join?
Jack
Hi,
I'm facing some problem installing DBCamera with cocoapods.How can i add it to my project without cocoapods?
Thanks
Lorenzo.
When the delegate method is called which processes the image, is there any way to detect if the photo was selected via the segue controller or captured by camera
I followed your code in my project:
DBCameraContainerViewController *cameraContainer = [[DBCameraContainerViewController alloc] initWithDelegate:self cameraSettingsBlock:^(DBCameraView *cameraView, DBCameraContainerViewController *container) {
[cameraView.photoLibraryButton setHidden:YES];
DBCameraGridView *cameraGridView = [[DBCameraGridView alloc] initWithFrame:cameraView.previewLayer.frame];
[cameraGridView setNumberOfColumns:4];
[cameraGridView setNumberOfRows:4];
[cameraGridView setAlpha:0];
[container.cameraViewController setCameraGridView:cameraGridView];
}];
[cameraContainer setTintColor:[UIColor redColor]];
[cameraContainer setSelectedTintColor:[UIColor yellowColor]];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:cameraContainer];
[nav setNavigationBarHidden:YES];
[cameraContainer setFullScreenMode];
[self presentViewController:nav animated:YES completion:nil];
Thanks for the addition of cropping to a square. Can this functionality be generalized so that photos can be cropped to an arbitrary aspect ratio (as opposed to 1:1)?
Hi @danielebogo
I received some good feedback from my team about dbcamera. Overall, very positive. They mentioned that they intuitively thought that the camera flash icon, would turn a flashlight on and off, not the camera flash. I agree with their feedback - there has been a ton of user training around using the lightning bolt icon to represent a camera flash.
Can we change default flash icon to a lightning bolt style icon?
Should be a few lines of extra code. You should send the metadata too, along with the UIImage.
I'd like to implement DBCamera on my app, but I require square pictures. Is there a way to force the user to use the crop function?
/*
DBCamera.strings
DBCamera
Created by iBo on 11/02/14.
Copyright (c) 2014 PSSD - Daniele Bogo. All rights reserved.
*/
"button.use" = "Kullan";
"button.retake" = "Tekrar Çek";
"general.error.title" = "Uyarı";
"general.button.cancel" = "İptal";
"pickerimage.nopolicy" = "Fotoğraflara erişim izni verilmemiş. Lütfen telefon Ayarlarından > Gizlilik > Fotoğraf bölümüne gidip uygulamamıza izin verip tekrar deneyin.";
"pickerimage.nophoto" = "Albümde fotoğraf bulunamadı.";
"pagecontrol.text" = "%i / %i (sağa/sola kaydırın)";
"cropmode.title" = "Kırpma Oranı";
"cropmode.square" = "Kare";
I'm using your DBCamera in my program,but it can't load the Icons and Filters.Can you do a test? Thx
Right now only images from the Camera Roll are loaded. It would be great if we could also find images from other Albums. Having the ability to first browse an Album then select an image would be great.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.