Welcome Guest, Not a member yet? Register   Sign In
uploading and using images
#26

[eluser]M4rc0[/eluser]
Ok so here is the thing.

It works perfectly, it resizes but it's not maintaining the name there.

I'm using the CI upload helper because of the validation (errors) and the random hash it generates for the filename.
So my last resort will be implementing both on your library (the validation will be boring, the random hash renaming is easy).

Here's how i used:
Code:
//i call the upload somewhere before this and get the data after it's sent
$img_data = $this->upload->data();
//refence of upload->data
//    [file_name]    => mypic.jpg
//    [file_type]    => image/jpeg
//    [file_path]    => /path/to/your/upload/
//    [full_path]    => /path/to/your/upload/jpg.jpg
//    [raw_name]     => mypic
//    [orig_name]    => mypic.jpg
//    [file_ext]     => .jpg
$this->resize_img($img_data['orig_name'],$img_data['full_path'],$img_data['file_path']);



Of course i'm using a resize_img function that does the code you posted passing those 3 parameters.

Now this is what is happening, consider i have the file with it's original name (the name that file has on my comp) like: my_picture.jpg
Then after using the CI upload helper the file is at public/images with the name: 2b0005c404f2.jpg
After using resize_img i get 2 files on /public/images:
my_picture.jpg (resized)
2b0005c404f2.jpg (not resized)

So you see what's going on here? It should have overwrited 2b0005c404f2.jpg, but it's taking again the original name and sending.

It's a detail, but interesting enough i don't know how to fix it.

I'm sure the problem is the first paramater i'm passing $img_data['orig_name'], but how to get the hash name of the picture?
upload->data(); doesn't return that..



Also sorry for my english, i've been reading my posts again and it looks terrible haha Big Grin


Messages In This Thread
uploading and using images - by El Forum - 09-14-2008, 08:24 AM
uploading and using images - by El Forum - 09-14-2008, 07:36 PM
uploading and using images - by El Forum - 09-16-2008, 01:51 PM
uploading and using images - by El Forum - 09-16-2008, 05:38 PM
uploading and using images - by El Forum - 09-17-2008, 03:00 AM
uploading and using images - by El Forum - 09-17-2008, 09:24 AM
uploading and using images - by El Forum - 09-17-2008, 09:39 AM
uploading and using images - by El Forum - 09-17-2008, 10:11 AM
uploading and using images - by El Forum - 09-17-2008, 10:55 AM
uploading and using images - by El Forum - 09-17-2008, 11:05 AM
uploading and using images - by El Forum - 09-17-2008, 11:19 AM
uploading and using images - by El Forum - 09-17-2008, 11:42 AM
uploading and using images - by El Forum - 09-17-2008, 12:16 PM
uploading and using images - by El Forum - 09-18-2008, 11:28 AM
uploading and using images - by El Forum - 09-19-2008, 06:20 AM
uploading and using images - by El Forum - 09-19-2008, 06:36 AM
uploading and using images - by El Forum - 09-19-2008, 06:38 AM
uploading and using images - by El Forum - 09-19-2008, 07:00 AM
uploading and using images - by El Forum - 09-19-2008, 07:08 AM
uploading and using images - by El Forum - 09-19-2008, 07:09 AM
uploading and using images - by El Forum - 09-19-2008, 07:11 AM
uploading and using images - by El Forum - 09-19-2008, 07:12 AM
uploading and using images - by El Forum - 09-19-2008, 07:19 AM
uploading and using images - by El Forum - 09-19-2008, 07:21 AM
uploading and using images - by El Forum - 09-19-2008, 09:13 AM
uploading and using images - by El Forum - 09-20-2008, 12:54 PM
uploading and using images - by El Forum - 09-20-2008, 02:46 PM
uploading and using images - by El Forum - 09-20-2008, 03:11 PM
uploading and using images - by El Forum - 09-20-2008, 03:28 PM
uploading and using images - by El Forum - 09-20-2008, 03:59 PM
uploading and using images - by El Forum - 09-20-2008, 04:10 PM
uploading and using images - by El Forum - 09-20-2008, 04:32 PM
uploading and using images - by El Forum - 09-20-2008, 05:41 PM
uploading and using images - by El Forum - 09-22-2008, 01:35 PM
uploading and using images - by El Forum - 09-22-2008, 01:59 PM
uploading and using images - by El Forum - 09-22-2008, 02:01 PM
uploading and using images - by El Forum - 09-23-2008, 02:57 AM
uploading and using images - by El Forum - 09-23-2008, 03:02 AM
uploading and using images - by El Forum - 09-23-2008, 03:19 AM
uploading and using images - by El Forum - 09-23-2008, 03:24 AM
uploading and using images - by El Forum - 09-23-2008, 03:38 AM
uploading and using images - by El Forum - 09-23-2008, 03:47 AM
uploading and using images - by El Forum - 09-23-2008, 04:16 AM
uploading and using images - by El Forum - 09-23-2008, 04:21 AM
uploading and using images - by El Forum - 09-23-2008, 10:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB