Welcome Guest, Not a member yet? Register   Sign In
How would I make a thumbnail?
#1

[eluser]trinic[/eluser]
I have several different photo galleries, the only problem is the "thumbnail" only fits the larger picture in to a smaller size so there is a lot of distortion and the load times are crazy.

How would I make each upload copy and convert a image to a thumbnail for display and link the smaller image to open the true size one?

Also, how do I make all the photo's on the site the same ratio, so there's not a black border on the sides of the ones that are different?

Are there scripts that do these things?
#2

[eluser]meigwilym[/eluser]
I see where you get your username.

First read everything on this page: http://ellislab.com/codeigniter/user-gui...e_lib.html

Now you know about image manipulation, you can now do this after uploading an image.

PHP has functions for copying files, so think about a /thumb/ directory, copy the file in there and resize.

Thumbnailing throws up a few problems. Do you want them to retain their aspect ratio (which can cause problems when displaying lots of them) or do you want a square thumbnail for each.

So:

* Choose a thumbnail size, say 100px
* choose which dimension to keep constant, either width or height - say height
* copy the file into /thumb/
* resize the height to 100px whilst maintaining aspect ratio

Now Robert's your father's brother.

Mei
#3

[eluser]trinic[/eluser]
I'm using uploadify to upload the files in to directories, can I use the libraries in conjuction with that or would I need to use codeigniter?

I came from a doing all php at one time and then switched to asp/asp.net and do mostly vb.net now. I have never worked with a framework like this. It makes life a lot easier but I'm still not fully aware of it's functionalities.
#4

[eluser]CroNiX[/eluser]
Sure, What I do is have my php uploadify processing script return json data to uploadify telling it the location of the uploaded files and filenames. Then that sends a json request to my CI controller that handles the thumbnail generation and copies them to where they need to go.

I believe you'd need to use the image_lib within codeigniter, although I like my own image processing scripts better. Smile
#5

[eluser]trinic[/eluser]
Have you ever used uberuploadcropper and impromptu to do the cropping?
#6

[eluser]CroNiX[/eluser]
Nope. I've used jCrop though on a photography project last summer.
#7

[eluser]Pert[/eluser]
Image_moo is a simple CodeIgniter library to handle image resize and cropping.

Code:
$this->image_moo
->load($_FILES['image']['tmp_name'])
->resize_crop(100,100)
->save('assets/new-file.jpg');




Theme © iAndrew 2016 - Forum software by © MyBB