Welcome Guest, Not a member yet? Register   Sign In
Jcrop & Code Igniter (Cant crop when there is parameter in the url)
#1

[eluser]Unknown[/eluser]
Hi i have some problem with Jcop.
When there is parameter in the url, it wont crop. How to solve this?

Status:

Can crop when there is no parameter. Image source is static, not from the function.

see attachment 1

Problem:

Cant crop image when there is url parameter. Image source come from the function.

see attachment 2

controller

Code:
function cropimage($filename)
    {
        //$data['filename'] = $filename;
        $data['imageurl'] = "uploads/images/$filename";
        $this->load->view('cropimages', $data); //cropimage

    }

view

Code:
<html>
    <head>

        [removed][removed]
        [removed][removed]
        <link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
        <link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css" />
        [removed]

            // Remember to invoke within jQuery(window).load(...)
            // If you don't, Jcrop may not initialize properly
            jQuery(document).ready(function(){

                jQuery('#cropbox').Jcrop({
                    onChange: showCoords,
                    onSelect: showCoords
                });

            });

            // Our simple event handler, called from onChange and onSelect
            // event handlers, as per the Jcrop invocation above
            function showCoords(c)
            {
                jQuery('#x').val(c.x);
                jQuery('#y').val(c.y);
                jQuery('#x2').val(c.x2);
                jQuery('#y2').val(c.y2);
                jQuery('#w').val(c.w);
                jQuery('#h').val(c.h);
            };

        [removed]

    </head>

    <body>

    <div id="outer">
    <div class="jcExample">
    <div class="article">

        <h1 align="center">Crop Image</h1>
        &lt;?php echo @$error; ?&gt;
        &lt;?php echo form_open('image/do_cropimage'); ?&gt;
            <div align="center">
            <label>X1 &lt;input type="text" size="4" id="x" name="x" /&gt;&lt;/label>
            <label>Y1 &lt;input type="text" size="4" id="y" name="y" /&gt;&lt;/label>
            <label>W &lt;input type="text" size="4" id="w" name="w" /&gt;&lt;/label>
            <label>H &lt;input type="text" size="4" id="h" name="h" /&gt;&lt;/label>
            &lt;input type="submit" value="Crop"/&gt;
            </div>
        &lt;?php echo form_close(); ?&gt;

        &lt;!-- This is the image we're attaching Jcrop to --&gt;
        <div align="center">
        <img src="&lt;?php echo base_url(); ?&gt;&lt;?php echo $imageurl; ?&gt;" id="cropbox" />
        </div>
        &lt;!-- This is the form that our event handler fills --&gt;
        

        


    </div>
    </div>
    </div>
    &lt;/body&gt;

&lt;/html&gt;




Theme © iAndrew 2016 - Forum software by © MyBB