Welcome Guest, Not a member yet? Register   Sign In
  SOLVED: image_lib, thumbnail generation
Posted by: El Forum - 09-10-2007, 02:32 AM - No Replies

[eluser]j0hn[/eluser]
im encountering problems in creating thumbnails using image_lib. can anyone help me on this...

the error shows like this:

Quote:The path to the image is not correct
Your server does not support the GD function required to process this type of image.

and my code is like this:

Code:
class Dummy extends Controller
{
    function Dummy()
    {
        parent::Controller();
        $this->load->library('layout', 'layout_main');
        $this->load->library(array('image_lib'));
        $this->load->helper(array('url', 'html'));
    }

    function index()
    {
        $data['title_for_layout'] = "test";

        $config['image_library'] = 'GD';
        $config['source_image'] = './images/asia2007thailanderawanredux/photo1.jpg';
        $config['create_thumb'] = true;
        $config['maintain_ratio'] = true;
        $config['width'] = '75';
        $config['height'] = '50';

        $this->image_lib->initialize($config);
        if (!$this->image_lib->resize()) {
            echo $this->image_lib->display_errors();
        }
        $this->layout->view('home', $data);
    }
}

my directory structure is like this:
Code:
|-- system
    |-- application
        |-- controllers
        |-- images
            |-- asia2007thailanderawanredux

* how can i correct my image path in my code using my directory structure?
* have a gd bundled (2.0.34 compatible)installed but im still getting error: server does not support gd.


  XSS Protection Problem - it blocks the page
Posted by: El Forum - 09-09-2007, 11:11 PM - No Replies

[eluser]xcristi[/eluser]
Hello,

Well, I turn on the XSS protection in CI configuration for automatic clean up. When I enter something nasty in a textarea, the filtering seems to work (?) but I get only a blank page as a result. The error thrown in logs is:

Code:
PHP Fatal error:  Call to undefined function:  get_instance() in /home/html/soimul/system/libraries/Input.php on line 855

I turn off this feature and try with some manual clean up ($this->input->post('field', 'true')) and it works very well. I can go on and use it this way, but it will be more convenient to do it automatically.

What do you think it's wrong in the first case?
Thanks.


  need help: css and images
Posted by: El Forum - 09-09-2007, 09:58 PM - No Replies

[eluser]j0hn[/eluser]
where can i store my css and image files in the ci directory layout? im confused a bit...
need help guys...


  Quick cash! Someone have a simple blog with CMS?
Posted by: El Forum - 09-09-2007, 08:36 PM - No Replies

[eluser]CI Lee[/eluser]
And more importantly would you like to sell it?

I don't have time to build a new one and would rather just pick one up... now I know there are WP and Typo etc... I would prefer one built in CI.

PM me if you have one!


-Lee


  File helper
Posted by: El Forum - 09-09-2007, 08:25 PM - No Replies

[eluser]latuss[/eluser]
Hi all...
I'm working with files... the write_file works fine.. but.. how can I delete a file?
I try with the

Code:
$file_delete = '/var/www/xmlrpc/listas/'.$nombre_lista.".txt";
delete_files($file_delete);

but does not work... so.. I try with the unlink

Code:
$file_delete = '/var/www/xmlrpc/listas/'.$nombre_lista.".txt";
unlink($file_delete);

and does not work either.. the file was created by the write_file method of the file helper...

any ideas?

Bye Smile


  Can't even get the installation right - (404 page not found error message)
Posted by: El Forum - 09-09-2007, 05:15 PM - No Replies

[eluser]bingecoder[/eluser]
Hi all;
I am on an 1and1 server and I have put codeigniter in the following directory of my site
www.mysite.com/codeigniter. Now this means that the path to applications directory is
www.mysite/codeigniter/system/application/.
This is content of the relevant part my config.php :

Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|    http://www.your-site.com/
|
*/
$config['base_url']    = "http://www.mysite.com/codeigniter/";

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = "index.php";

/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of "AUTO" works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO'            Default - auto detects
| 'PATH_INFO'        Uses the PATH_INFO
| 'QUERY_STRING'    Uses the QUERY_STRING
| 'REQUEST_URI'        Uses the REQUEST_URI
| 'ORIG_PATH_INFO'    Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol']    = "AUTO";

/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://www.ellislab.com/codeigniter/user-guide/general/urls.html
*/

$config['url_suffix'] = "";

/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language']    = "english";

/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
*/
$config['charset'] = "UTF-8";

/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the "hooks" feature you must enable it by
| setting this variable to TRUE (boolean).  See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;


/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries.  For more information please see the user guide:
|
| http://www.ellislab.com/codeigniter/user-guide/general/core_classes.html
| http://www.ellislab.com/codeigniter/user-guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'MY_';


/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.  By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';


However when I navigate to www.mysite.com/codeigniter/ all I get is a 404 page not found error. Am I doing this right ?


  SOLVED: where are my $_FILES
Posted by: El Forum - 09-09-2007, 04:10 PM - No Replies

[eluser]vevmesteren[/eluser]
Good evening all

I am starting to get seriousely desperate here. A form that was working perfectly fine stopped working. And I cannot for the life of it, figure out why that is. I am running the last version of CI. I have a form (normally it is huuge, but in an effort to find out wtf is wrong I have cut it down a lot.


Code:
<?=form_open_multipart('inscription/addUser'); ?>
<tr>
    <td colspan='2'>Files</td>
</tr>
<tr>
    <td>Some data: </td>
    <td>
&lt;input type="file" name="audiofile" size="20"&gt;</td>
</tr>

<tr>
    <td colspan='2'>&lt;input type="submit"&gt;</td>

</tr>

&lt;/form&gt;

when I then
Code:
var_dump($_FILES)
I get zilch, nada nothing. As in:
Code:
array(0) { }
. Why is that? It was working perfectly fine before.

oh yes before I forget here my library load script:
Code:
$config['upload_path'] = './uploads/';
            $config['allowed_types'] = 'jpg|mp3|avi|mov|m4a';
            $config['remove_spaces'] = TRUE;
            $config['max_size'] = '1000000';
                
            $this->load->library('upload', $config);

PHP info tells me that file_uploads are 'on'


  Wrong result of length validation when using russian and utf-8
Posted by: El Forum - 09-09-2007, 03:27 PM - No Replies

[eluser]Unknown[/eluser]
The case is simple:

When I input 10-letters word in the field and set max_length[20] for it, it validates. And when there's 11-letters word, validator raises an error "The title field can not exceed 20 characters in length.", that is certainly wrong.

I suppose, the reason is that utf-8 is two-byte encoding.


  Possible Image Lib bug?
Posted by: El Forum - 09-09-2007, 02:21 PM - No Replies

[eluser]jstrebel[/eluser]
Is this a bug or am I just not getting it: I upload an image, resize it to $x1,$y1 then thumbnail it to $x2,$y2. So i should have 2 images.. one called image.jpg and another called image_thumb.jpg.

Code:
//$path= path to file, $x,$y are size demisions
function _image_resize ($path,$x1,$y1,$x2,$y2)
        {

                        $this->image_lib->clear();
                        //resize Image
                        $config['image_library'] = 'GD2';
                        $config['source_image'] = $path;
                        $config['width'] = $x1;
                        $config['height'] = $y1;
                        $config['master_dim'] = 'auto';
                        $config['quality'] = '100%';

                        $this->image_lib->initialize($config);
                        $this->image_lib->resize();
                        
                        $this->image_lib->clear();
                        //thumbnail the image just resized
                        $config2['image_library'] = 'GD2';
                        $config2['source_image'] = $path;
                        $config2['width'] = $x2;
                        $config2['height'] = $y2;
                        $config2['master_dim'] = 'auto';
                        $config2['quality'] = '100%';
                        $config2['create_thumb'] = TRUE;

                        $this->image_lib->initialize($config2);
                        $this->image_lib->resize();
        }

What I am actually getting from this function is 1 image called image.jpg (no _thumb) sized to $x2,$y2 (the thumbnail specs). Any thoughts?


  Complex DB query using CI helpers
Posted by: El Forum - 09-09-2007, 01:46 PM - No Replies

[eluser]Guillem[/eluser]
I have a table (altas) in my db with some foreign keys to other fields of other tables (clientes, estados, usuarios):

Quote:id
id_usuario => usuarios->id
id_estado => estados->id
id_cliente => clientes->id
...
I was trying to use the helpers of CI, since I'd like to make a query with some values that might be entered into a form. My code is that:
Code:
$this->db->select('u.usuario, c.id as cid, c.apellidos, c.nombre, c.dni, e.estado, a.id, a.fecha, a.comentario, a.linea');
if ($this->session->userdata('nivel')>1) {
    if ($_POST['usuario'] != 0) { $this->db->where('a.id_usuario',$_POST['usuario']); }
}
            
if ($_POST['operadora'] != 0) { $this->db->where('a.id_operadora',$_POST['operadora']); }
            
if ($_POST['desde'] != null) {        
    $a = explode("/",$_POST['desde'],3);
    $this->db->where('a.fecha >=',mktime(0,0,0,$a[1],$a[0],$a[3]));
}
            
if ($_POST['hasta'] != null) {        
    $a = explode("/",$_POST['hasta'],3);
    $this->db->where('a.fecha <=',mktime(24,59,59,$a[1],$a[0],$a[3]));
            }
            
if ($_POST['estado'] != 0) { $this->db->where('a.id_estado',$_POST['estado']); }
            
$this->db->where('u.id','a.id_usuario');
$this->db->where('c.id','a.id_cliente');
$this->db->where('e.id','a.id_estado');
            
$this->db->orderby('a.fecha','asc');
$data['altas'] = $this->db->get('altas a, clientes c, usuarios u, estados e');
It seemed it worked fine until I added this 3 lines:
Code:
$this->db->where('u.id','a.id_usuario');
$this->db->where('c.id','a.id_cliente');
$this->db->where('e.id','a.id_estado');
What I was trying to do is to generate a query similar to this:
Code:
$this->db->query("SELECT u.usuario, c.id as cid, c.apellidos, c.nombre, c.dni, e.estado, a.id, a.fecha, a.comentario, a.linea FROM altas a, usuarios u, estados e, clientes c WHERE a.id_usuario='".$_POST['usuario']."' AND a.id_operadora='".$_POST['operadora']."' AND a.fecha>='".$_POST['desde']."' AND a.fecha<='".$_POST['hasta']."' AND a.id_estado='".$_POST['estado']."' AND u.id=a.id_usuario AND c.id=a.id_cliente AND e.id=a.id_estado ORDER BY a.fecha DESC");
I'm really a pretty newbie in CI development, so I'm quite confused about what to do, since this seems quite coherent for me, but the query shows nothing with the helpers and data if I run it manually.

Can any body make me see the light, please?

Thank you all folks Smile


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
Why PHP is still worth le...
by InsiteFX
7 minutes ago
Any user guid or video o...
by msnisha
8 hours ago
MVC vs MVCS vs CodeIgnite...
by massimiliano1.mancini
Today, 10:15 AM
Is hiring a digital marke...
by Markhenry123
Today, 02:45 AM
my controller fails to fi...
by PaulC
Today, 01:40 AM
My Library cannot see ses...
by InsiteFX
Yesterday, 08:48 PM
update the framework to t...
by captain-sensible
Yesterday, 12:14 PM
CodeIgniter Shield 1.0.0 ...
by Ayatorvi
Yesterday, 06:06 AM
Update to 4.6.1
by serialkiller
05-07-2025, 11:58 AM
Can't create new database...
by paulbalandan
05-07-2025, 08:49 AM

Forum Statistics
» Members: 145,004
» Latest member: jonopaul
» Forum threads: 78,382
» Forum posts: 379,421

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB