Welcome Guest, Not a member yet? Register   Sign In
jpegcam (jquery plugin) and codeigniter
#1

[eluser]Nikita[/eluser]
Hi,

I'm trying to get jpegcam working with codeigniter. But it seems like this is harder then i first thought.

WIKI API: http://code.google.com/p/jpegcam/wiki/APIDocs

My problem i basically "webcam.set_api_url( 'test.php' );" where i need to access a php file. But, i need the codeigniter goodies and tools, so using a php-file outside of codeigniter is unacceptable. When i create a library class i can't access it, even if i remove the .htaccess file (just for testing).

Is there anyway i can give a normal .php file the codeingiter tools without a class? i've also tried to use __construct but it seems like the file wont work then.

Any help would be great!

NOT Working code:
Code:
class Webcam
{
    public function __construc() {
        parent::__construct();
        $folder = 'uploads/';
        $filename = strtotime("now").'.jpg';
        $input_con = file_get_contents("php://input");
        $file_path = $folder.$filename;
        file_put_contents($file_path,$input_con);
    }
    
}

Working code:
Code:
$folder = 'uploads/';
$filename = strtotime("now").'.jpg';
$input_con = file_get_contents("php://input");
$file_path = $folder.$filename;
file_put_contents($file_path,$input_con);
#2

[eluser]Aken[/eluser]
Just use a normal CI-style URL, like example.com/jpegcam, which would then load a controller named Jpegcam. Inside it would be your code for handling whatever the JS script sends it. You're overcomplicating things.
#3

[eluser]Nikita[/eluser]
I've already tried this, and it's not working. That was the first thing i did, also tried with a clean install of CI.

Dunno if it's the file_get_contents("php://input"); or something like that. (Yes, the script still works fine outside of CI)
#4

[eluser]Aken[/eluser]
What CodeIgniter resources do you need? You should also state specifically what is not working. Are you receiving an error, or what?
#5

[eluser]Nikita[/eluser]
No errors at all, i'll need to use the sessions and image cropping class.
#6

[eluser]Aken[/eluser]
I don't know what CI does to any POSTed data well enough to know exactly why you wouldn't be able to access "php://input", but I'm sure there's some sort of way you could get it to show up properly in a standard CI controller. You should do some testing, maybe look into the Core code and see what might be affecting this.

As a last resort (you should do the above first), perhaps you could send a cURL request to a CI file from your outside script with whatever data you'd need, like the filename and whatnot.




Theme © iAndrew 2016 - Forum software by © MyBB