CrazyEngineers
  • Hey i m writing a code to resolve captcha and resolve barcode data from 2 different images using php. the images that needs to be resolved is in the same directory as the code. But the code isnt fetching it. Anyone any help on this function? The part of code which fetches the image is below.

    public function setImage($img = "php_captcha")
            {
                    if(!$this->LoadImage($img.".png")) echo "Image has not been found";
            }
    Its appreciated if anyone can help on this function. this one works for my other codes but here i m a bit confused. If you need full code I will post it if asked for.
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Manish Goyal

    MemberAug 4, 2013

    Can you post definition of $this->LoadImage()?
    Are you sure? This action cannot be undone.
    Cancel
  • Nayan Goenka

    MemberAug 4, 2013

    its default
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberAug 4, 2013

    Impossible

    There is no such function in php named loadImage

    Assuming it is following OOps, check it's parent class
    Are you sure? This action cannot be undone.
    Cancel
  • Nayan Goenka

    MemberAug 5, 2013

    ohhh abt that function:

    This is it

    private function LoadImage($img)
            {
                    if (file_exists($img))
                    {
                                    $image_info = getimagesize($img);
                                    $image_size = explode("\"", $image_info[3]);
                                    $this->image_width = $image_size[1];
                                    $this->image_height = $image_size[3];
                                    $this->img = imagecreatefrompng($img);
                                 
                                    return true;
                    }
                    else
                    {
                                    return false;
                    }     
            }
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberAug 5, 2013

    The function seems correct
    This function assumes, image file path as it's argument
    Did you check if the path is correct or not?
    Are you sure? This action cannot be undone.
    Cancel
  • Nayan Goenka

    MemberAug 5, 2013

    checked everything. Funny thing is, the program is running now, but gives an unusual warning now.

    Image has not been found
    Notice: Undefined offset: 1 in C:\xampp\htdocs\PHP\prog11.php on line 115
    No Characters have been detected
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberAug 6, 2013

    The problem is with this chunk of code

    $image_size = explode("\"", $image_info[3]);
    
    GetImageSize returns an array, you can't explode it

    Simply remove this line and make it following

    $image_info = getimagesize($img);
    $this->image_width = $image_size[1];
    $this->image_height = $image_size[3];
    Please check whether it is 1st or 2nd is width

    Thanks
    Are you sure? This action cannot be undone.
    Cancel
  • Nayan Goenka

    MemberAug 6, 2013

    goyal420
    The problem is with this chunk of code

    $image_size = explode("\"", $image_info[3]);
    
    GetImageSize returns an array, you can't explode it

    Simply remove this line and make it following

    $image_info = getimagesize($img);
    $this->image_width = $image_size[1];
    $this->image_height = $image_size[3];
    Please check whether it is 1st or 2nd is width

    Thanks



    Thanks for the try but it didnt work out with your code.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register