Welcome Guest, Not a member yet? Register   Sign In
Multiple image upload with resize, thumb and preview
#1

[eluser]ToddyBoy[/eluser]
Hi everyone,

I'm trying to go through the logic of getting the title of this post done. I thought I would ask for some advice/opinions before I dive head first into creating it.

The background behind it is I am creating a system for a real estate agency to upload photos of their listings to their website. When the agent creates a new listing, they enter the address, price, etc of the listing. This part is no problems. I can get the form to submit everything into the db and display it on relevant pages. I am using jQuery to perform validation on the data and to create the records in the db so I can use it display a success or error message without refreshing the page.

I would like to use jQuery, if possible, along with the CI file upload and image manipulation libraries to have the agent select an image, have jQuery and/or CI upload and manipulate the image but also have a preview appear on the form before it is finally submitted and the listing is created.

I'm pretty sure I could get the file upload and image manipulation to work without having the preview. When the images are finally uploaded into the images directory, they will have the listing id as the file name as well as another number to make them unique - 10-1.jpg, 10-2.jpg, etc. Renaming the file shouldn't be a problem either.

Here's my dilemma, the images need to have the listing id as part of their file name but the listing won't get it's id from the database table until it gets submitted into the database.

I am planning on putting the image details into a separate table in the db, linked to the listing table by the listing id.

Has anyone tried something like this before? Am I thinking too far outside the box?

Thanks in advance for any advice.
Todd
#2

[eluser]aquary[/eluser]
How about storing them into a table, but without listing ID and using the old name, return the image ID to the form then keep them in some hidden input. After the listing is created, you can just rename/update those images with the new listing ID.

Also, you'll need some kind of clean up function to delete old images with no listing ID after a period of time.




Theme © iAndrew 2016 - Forum software by © MyBB