forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 upload => Topic started by: mehware on October 08, 2010, 05:39:10 pm

Title: iPhone Uploader App - Bring your Gallery Mobile
Post by: mehware on October 08, 2010, 05:39:10 pm
Hello,

I did an iPhone search and didn't find much helpful information so I am deciding to do it myself :D

I am an independent programmer/game developer for the Apple iPhone and iPad. I have PHP and database knowledge as well.

As my first post I wanted to say, I love coppermine, it has a great community and software.

I currently have a coppermine gallery at http://mursespotting.com

It was a joke website I made about a friend who where's a "man purse"  The idea is simply, see a guy with a shoulder bag take a picture and upload it.  Its all in good fun.  I want to take it mobile, I am sure many of you want to take your gallery mobile too.

Making your gallery into a free iPhone app can reach thousands. 

My plan which I have already started is to make an iPhone app that embeds the coppermine gallery website.  This is simple.  Its a UIWebView that treats your website like its running in safari on the iphone

On the bottom there will be an upload button which will bring the standard "roll up" dialog that says "Take picture" or "Choose Existing Picture".  This will access the camera or the photo viewer app.

All the Objective C is easy to do on my end. 

I do know PHP but I do not know the Ins and Outs of coppermine. 
 
Thats where you come in!

If someone is willing to help direct me in properly uploading a picture to coppermine assuming I can grab the file path and file stored in the directory I will release an iPhone project framework where people who decide to sign up with Apple as a developer can release their iPhone App and go mobile with their gallery.

All they would have to do is change a link (your gallery website) in the code and build the app in xCode.

Some considerations I would like is "auto resizing" I think coppermine can do that because some of the newer iPhones can take some pretty high res photos.

Whos willing to help?

I'll be posting screenshots later today of my progress.

P.S. if anyone want to look me up on itunes store search "mehware".

- Matt
Title: Re: iPhone Uploader App - Bring your Gallery Mobile
Post by: Αndré on October 09, 2010, 09:37:20 am
Not sure what information you need. I have no idea how iPhone apps work, so maybe I'm thinking in the wrong direction. Coppermine has an upload form, which you can embed or recreate in your app. The rest is handled by Coppermine (adding the picture to the database, resize it if it's too big, etc.).
Title: Re: iPhone Uploader App - Bring your Gallery Mobile
Post by: mehware on October 10, 2010, 01:35:50 am
Andre, thanks for the post.

The app or framework will upload existing pictures initially and have the ability to take a photo and upload.  The Obj-C side straight forward for me.  Apple gives you access to the photo picker/camera.

In upload.php I was looking up the simple form for a single file.  This seems perfect.

I was also looking at my gallery and saw this link, http://www.mursespotting.com/msgallery/upload.php?method=html_single&album=1

I was thinking of defaulting to the simple form and predetermined album.  Like a "Mobile Uploads" album.

I want to create a mobileupload.php that will be like an automatic uploader access when you hit the "upload" button as the main button on the bottom tool bar.  So hitting the "upload" button will load this page in the webview/coppermine gallery website above.

I can access the files directory where the image is stored.  I need to put that file path in coppermine's upload script in mobileupload.php

I just need help on creating mobileupload.php so the coppermine can upload the picture automatically to the specified album.

Let me know if any of that makes sense.  I'll show a screenshot of the app running in the simulator really soon.

I am decent at php but I don't know the ins and outs of the coppermine upload process as I am new to it.

Thanks,

- Matt
Title: Re: iPhone Uploader App - Bring your Gallery Mobile
Post by: Αndré on October 10, 2010, 11:14:56 am
Not sure why you want to create new php file. All you have to do (I think, hadn't looked at the code yet) is sending the file and the album id to db_input.php.
Title: Re: iPhone Uploader App - Bring your Gallery Mobile
Post by: mehware on October 10, 2010, 10:16:31 pm
I looked at db_input.php and noticed the "event" parameter and looked at the "picture" event.

How exactly do you pass in the album id ("1") in my case and the filePath/Name into db_input.php ?

is it a part of the url?

like http://www.mursespotting.com/db_input.php?event=picture;album=1;filePath=insertHere

Or something similar.

I just am not sure how to pass the filename/filepath in.

Thanks again,

I think we are almost there!

- Matt
Title: Re: iPhone Uploader App - Bring your Gallery Mobile
Post by: Nibbler on October 10, 2010, 10:37:01 pm
db_input.php accepts its files via HTTP POST. To add files from a local path you could use addpic.php instead, but it is admin only obviously.
Title: Re: iPhone Uploader App - Bring your Gallery Mobile
Post by: mehware on October 11, 2010, 01:54:26 am
so I can make an upload to a mobile album I create and get rid of the required admin part making an mobileaddpic.php and doing something like

http://www.mursespotting.com/mobileaddpic.php?pic_file=picturePathPlusName and do mobileaddpic.php just like the addpic.php but minus the admin requirement.

This url will be accessed when the user selects the file in the picture picker and this above link will be called.

Is this correct?

- Matt
Title: Re: iPhone Uploader App - Bring your Gallery Mobile
Post by: Joachim Müller on October 11, 2010, 07:18:05 am
That's not a feature in HTML / your browser. In fact it is a feature in HTML to disallow you from doing that. The browser can not access a local file and send it to a server that way, as it would open you against fraud, so no: you can't do that in HTML, nor can you do that in PHP, as the PHP interpreter runs server-sided and therefore isn't allowed to access the client's file system content.
You could do something similar (send the file) in Java (which is not JavaScript) as far as I can see, but I can't see the point in the first place: you don't need to develop anything special: the iPhone after all has got a browser, which will be able to send data to the server using HTML forms. All that is left to do on the iPhone is providing screens for the small resolution of an iPhone (compared to regular PC screen resolutions), which can be accomplished by coming up with a theme for small resolutions.
As far as I can see you're no ready to pay someone for the advice given here, so this thread doesn't belong into the sub-board Looking for Freelancers / Paid help (http://forum.coppermine-gallery.net/index.php/board,30.0.html) in the first place. Moving to regular support.
I can see that there might be a need for an app on a mobile gadget to send pictures taken with the camera of that app to a gallery running Coppermine, but you can not just come up with an app that just adds the path to the local file to the URL as an additional parameter - that's just not how a browser works, but wishfull thinking - your app needs to send the actual file to the server and not just information about the location of the file, as the server doesn't have the power to pull a file from the client. If a server had the power to pull files from a client, what would keep malevolent server owners from stealing visitor's files? That's why Nibbler told you
db_input.php accepts its files via HTTP POST.
The solution doesn't lie in an additional server-sided file that skips admin authentification.
Title: Re: iPhone Uploader App - Bring your Gallery Mobile
Post by: mehware on October 11, 2010, 06:06:41 pm
Thank you! I apologize for posting in the wrong sub forum.

I'll do more research on my part.

- Matt
Title: Re: iPhone Uploader App - Bring your Gallery Mobile
Post by: DigitalMind on October 18, 2010, 09:14:23 pm
I really hate to give up some of my tricks, but I basically already have this.  Demotivationalpics.com has an Iphone app that uses Cpmfetch (modified slightly) to display images to Iphone users, and I paid Foulu to make me a kind of "auto-upload" script to easily add any picture from anywhere on the web into coppermine. (Which I use for the demotivational poster generator and my firefox add-on) Now these are 2 totally different things, and for the moment through the Iphone app users can't upload to demotivationalpics.com,  however if you put the two together everything's already in place for it. 

If you're gonna be working on this and need a little help,  I might be able to lend a hand.  Let me know ...