Welcome Guest, Not a member yet? Register   Sign In
Image Resizing Questions/Problems
#1

[eluser]Paul Skinner[/eluser]
I am very new to CodeIgniter, and not quite so new (but still fairly new) to PHP, so please be extra lovely and explain things so that I can learn for next time.

The standard code for resizing images using CI is below.
This is highly useful for what I need, however I am stuck as to how to add the extra functionality that I require.

Background on what I need:

I need to be able to resize up to 50 (unlikely it'll ever actually reach 50 in one go) images in to two smaller versions of the original, and move the original to a different location (i.e. copy to a different location and delete the old one).
The script should be able to read all the pictures in a particular directory like the one below and do the conversion. It is not necessary for the script to read sub-directories.

domain.com/admin/uploaded/photos/
(which contains image1.jpg, image2.jpg, image3.jpg etc).

Once the conversion is complete I should end up with these URLs, for example.

domain.com/pictures/original/image1.jpg
domain.com/pictures/medium/image1.jpg
domain.com/pictures/smaller/image1.jpg


and the URL domain.com/admin/uploaded/photos/ should be empty (ready for when the next set of photos are uploaded).

The method of resizing that is supplied below is fine (where an ideal size is set and CI tries to resize it as close as possible while keeping the aspect ratio.

The script does not need to randomise the file name.

It would be extra lovely if it could output a message when conversion is complete, but that may be more hassle than is worth it.


Thank you in advance for any help you give.

Paul

Code:
$config['image_library'] = 'gd2';
$config['source_image'] = '/path/to/image/mypic.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;

$this->load->library('image_lib', $config);

$this->image_lib->resize();


Messages In This Thread
Image Resizing Questions/Problems - by El Forum - 07-09-2008, 04:54 PM
Image Resizing Questions/Problems - by El Forum - 07-09-2008, 05:01 PM
Image Resizing Questions/Problems - by El Forum - 07-09-2008, 05:29 PM
Image Resizing Questions/Problems - by El Forum - 07-09-2008, 08:27 PM
Image Resizing Questions/Problems - by El Forum - 07-11-2008, 11:21 AM
Image Resizing Questions/Problems - by El Forum - 07-11-2008, 12:34 PM
Image Resizing Questions/Problems - by El Forum - 07-11-2008, 12:45 PM
Image Resizing Questions/Problems - by El Forum - 07-11-2008, 01:35 PM
Image Resizing Questions/Problems - by El Forum - 07-11-2008, 01:51 PM
Image Resizing Questions/Problems - by El Forum - 07-11-2008, 01:52 PM
Image Resizing Questions/Problems - by El Forum - 07-11-2008, 02:03 PM
Image Resizing Questions/Problems - by El Forum - 07-11-2008, 03:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB