Welcome Guest, Not a member yet? Register   Sign In
String function Error !
#1

[eluser]Vaibhav132[/eluser]
The below code works exactly the way i want on windows, but on Linux it shows me some severity error.
Please help me out with this issue..


ERROR !

A PHP Error was encountered

Severity: Warning

Message: Wrong parameter count for strstr()

Filename: controllers/image.php

Line Number: 39

Code:
public function index($start = 0)
{
        
  if ($this->input->post('btn_upload')) {
            $this->upload();
        }

        $this->load->library('pagination');

        $c_paginate['base_url'] = site_url('image/index');
        $c_paginate['per_page'] = '9';
        $finish = $start + $c_paginate['per_page'];
        
        if (is_dir($this->data['dir']['thumb']))
        {
            $i = 0;
            if ($dh = opendir($this->data['dir']['thumb'])) {
                while (($file = readdir($dh)) !== false) {
                    // get file extension . **ERROR is shown at this line

                      $ext = strrev(strstr(strrev($file), ".", TRUE));
                    if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png') {
                        if ($start <= $this->data['total'] && $this->data['total'] < $finish) {
                            $this->data['images'][$i]['thumb'] = $file;
                            $this->data['images'][$i]['original'] = str_replace('thumb_', '', $file);
                            $i++;
                        }
                        $this->data['total']++;
                    }
                }
                closedir($dh);
            }
        }
}






Theme © iAndrew 2016 - Forum software by © MyBB