I need help to resize image before uploading |
[eluser]DumpProgrammer[/eluser]
I have a model function that creates and upload an image and also creates a thumbnail but I do not know how to resize the initial image before its uploaded. The examples shown are just for resizing an image. Here is my current function. Code: $config['upload_path'] = 'uploads/';
[eluser]Twisted1919[/eluser]
1.How could you ever re-size an image before you upload it ? Does this makes sense to you ? You process an image AFTER you have it uploded on your server . 2.Don't use Models for these tasks . Use a helper or a plugin for this . 3.Codeigniter Resizing class requires a lot of work and calculation to get a nice looking image , that's because it doesn't have an Adaptive Resizeing Method , BUT PhpThumb does ( http://phpthumb.gxdlabs.com/ ) So if i were you, i would use codeigniter upload library to upload my image , then , using phpthumb , i would resize it with desired width and height using adaptive resize method .
[eluser]DumpProgrammer[/eluser]
I realise it doesnt make sense but I was just assuming someone would know that the image I want stored on my computer or server will be the resized image. I thought codeigniter can resize an image for me and also maintain the image ratio Quote:$config['maintain_ratio'] = TRUE;. So if the initial image that I upload can be stored on a tempfolder and then used to generate a smaller image then thats exactly what I am looking for.
[eluser]DumpProgrammer[/eluser]
I am trying to use the phpthumb but there is no documentation on how to use it. I need to intergrate it into CI so I think I will put it into plugins folder. Can anyone give me a hint or direction on how I can use it to save images onto my server and also retrieve the image file and thumb file name. Thanks
[eluser]Dyllon[/eluser]
[quote author="DumpProgrammer" date="1267310011"]So if the initial image that I upload can be stored on a tempfolder and then used to generate a smaller image then thats exactly what I am looking for.[/quote] You kinda just answered your own question, upload the image to a temporary location, resize it specifying a new image name and location, and lastly unlink your temporary image. All easily done with the CI image library |
Welcome Guest, Not a member yet? Register Sign In |