Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter - Image Resize Not Working
    primarykey
    data
    text
    <p>I just started programming a week or two ago, so I apologize for the probably terrible code, but I've been having a hard time figuring this one thing out. I've managed to get the files to upload to the designated destination, but I just can't get the resize/image manipulation tool to work.</p> <p>The code that's giving me the problem is the commented out section, and I've already made sure to give the folders the proper privileges. Any help would be outstanding.</p> <p>I've also been curious how I would use absolute paths for something like this,</p> <p>Thanks a ton.</p> <p>function avatar_update() {</p> <pre><code> $config['upload_path'] = './avatars/'; $config['allowed_types'] = 'jpg'; $config['max_size'] = '100'; $config['max_width'] = '100'; $config['max_height'] = '100'; $config['file_name'] = time(); $filename = $config['file_name']; $this-&gt;load-&gt;library('upload', $config); if( ! $this-&gt;upload-&gt;do_upload()) { $error = $this-&gt;upload-&gt;display_errors(); $this-&gt;session-&gt;set_flashdata('msg', $error); $this-&gt;load-&gt;view('General/header'); $this-&gt;load-&gt;view('profile_view', $error); $this-&gt;load-&gt;view('General/footer'); } else { // $this-&gt;load-&gt;library('image_lib'); // $resize['image_library'] = 'gd2'; // $resize['source_image'] = './avatars/'.$filename.'.jpg'; // $resize['maintain_ratio'] = TRUE; // $resize['create_thumb'] =TRUE; // $resize['width'] = 50; // $resize['height'] = 50; // $this-&gt;load-&gt;library('image_lib', $resize); // $this-&gt;image_lib-&gt;resize(); $username = $this-&gt;session-&gt;userdata('username'); $avatar = array( 'avatar' =&gt; $filename ); $this-&gt;db-&gt;where('username', $username); $this-&gt;db-&gt;update('users', $avatar); $this-&gt;db-&gt;select(); $this-&gt;db-&gt;where('username', $username); $query = $this-&gt;db-&gt;get('users'); if ($query-&gt;num_rows() &gt; 0) { $user_details = $query-&gt;row_array(); } $this-&gt;session-&gt;set_userdata($user_details); $this-&gt;load-&gt;view('General/header'); $this-&gt;load-&gt;view('profile_view'); $this-&gt;load-&gt;view('General/footer'); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload