Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Konwersacja do jpg
--armind--
post 24.05.2013, 00:09:21
Post #1





Goście







Czesc.

Mam tutaj problem, ponieważ po wrzucaniu plikow nie konwertuje do jpg - wrzuca wszystkie pliki/formaty: png, gif a ma tylko jpg


Gdzie leży problem?

  1. public function img()
  2. {
  3. if ($this->input->post('add'))
  4. {
  5. unlink('public/uploads/'.$this->session->userdata('user_id').'.jpg');
  6. $config['upload_path'] = './public/uploads/';
  7. $config['allowed_types'] = 'jpg|gif|png';
  8. $config['max_size'] = '2048';
  9. $config['max_width'] = '0';
  10. $config['max_height'] = '0';
  11. $config['file_name'] = $this->session->userdata('user_id');
  12. $this->upload->initialize($config);
  13. $this->load->library('upload', $config);
  14. if (!$this->upload->do_upload('file'))
  15. $this->session->set_flashdata('error', 'Wystąpił błąd, spróbuj ponownie.');
  16. else
  17. {
  18. $config['image_library'] = 'gd2';
  19. $filepath = $data['full_path'];
  20. $config['source_image'] = $filepath;
  21. $config['new_image'] = $filepath.$this->session->userdata('user_id').'.jpg';
  22. $config['maintain_ratio'] = FALSE;
  23. $config['width'] = 150;
  24. $config['height'] = 100;
  25. $config['master_dim'] = 'auto';
  26. $this->load->library('image_lib', $config);
  27. $this->image_lib->resize();
  28. $imagetype = $data['image_type'];
  29. if ($imagetype != 'jpeg')
  30. unlink($filepath);
  31. }
  32. redirect('profile/img');
  33. }
  34. else
  35. $this->load->view('profileavatar');
  36. }
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
--armind--
post 24.05.2013, 22:18:36
Post #2





Goście







Prosze o pomoc
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 26.06.2025 - 20:05