multiple tabs and php uploader - php

I made admin in page in order to let the user add main data of page, name, second name, address, image 1(php uploader with thumbs) , image 2(php uploader with thumbs),gallery uploader (php and jquery)
then I faced an issue with multiple tabs and I solved it. in main data
The problem is in the 3 uploaders
Because I used to upload images with its thumbnails with different size, so I have to make it with sessions in order to know where to upload and which is the size
The problem is in multiple tabs issue the sessions are overwritten
So how I can make alias or sessions to be specific in each window but with same name? Is it possible?
N.B: I mean multiple tabs in browser with same sessions name

Do you mean tabs like as in jQuery UI tabs or some other UI library?
If so, because all the data in the tabs are in reality on one page, in one form, if you have more than one image to upload (say one on each tab), you will need to make sure that the data in the form for each of the multiple images is in an array - one element for each image.
You will then need to loop through the array to get the info for the multiple images when you submit the form.

Related

How to make an image selector to choose an image from the server to use in HTML form

I have built a blog system where each entry has an associated image file. I have created a php upload for this system and can get everything onto the server. When I write each blog post I have a row in my database which stores the filename of the image, so I could, if I knew the filename already, just type it in.
What I want to do is on my blog post form, instead of being able to type the file name, I want a button to click on which opens a window with all my images in it, then I can click on one and have that filename sent back to the form.
I suppose I could use AJAX to do this but it seems over complicated. Does anyone know of a good way to achieve this.

php - uploading custom images on product page via AJAX

I am writing a small e-commerce website and I need to be able to allow users to upload their own custom images (limited to JPG or PNG) before they add to basket so that the images can be included with the order.
My current idea is to upload the files via AJAX and insert the filenames into the database so I can then link the images to a product and a specific order in the database. However, I have read that you cannot easily do this with AJAX as it is not yet supported?
Should I literally use a normal file upload form and process the $_FILES and $_POST requests after the form is submitted. This is already being done when items are being added to the basket so would be possible, although this could take a while to process the uploads.
Am I missing an obvious method that will solve the problem?
You need to post the form to a hidden iframe, output a json response to the iframe and then parse the response via javascript.

upload image, then put file path into a form

I just need a bit of advice on what direction to go with something I am creating.
It is a simple php based webpage for our sports and social members in our office, allowing them to create, edit, view and delete events for all members to see. Events like day trips, bbq's and all kinds of things like that.
So far I have it all working as I would like, other than one thing, being the event logos.
At present, the events are all stored in a mysql database, in one table, with a column for every aspect of the event; time, date, price, venue etc etc.
I also have two columns for the event logos, one for the venue logo, and one for the general event logo.
What I need advice on, is the best way to create a page that allows a user to upload an image to the server, browse the images already uploaded, select one, and have it's file path entered into a text input when creating the event.
Could someone offer their suggestions on the best way to go about this, or offer an alternative method for selecting and inputting a logo for the event?
Thanks
The Uploadify jQuery plugin works really well for batch and/or AJAX uploads. The way I'd handle your situation would be this:
Show all images on the same page with the form, and give each image a related radio button with the image path as the button's value, so the user simply checks the image they want to use,
If the user wants to upload images, use the Uploadify plugin and it's AJAX callback functions to dynamically populate the existing list of radio buttons.
The comment I made on your question, asking wether you store images (or their file paths) was because I think it would be much easier (and cleaner) for you to retrieve a list of uploaded images by querying a database. Personally, I don't store images in a database, only their file paths, and use PHP to handle any images that need to be deleted or moved. It's easier to assing images to other entities (especially in many-to-many relationships) that way.
If you don't want to store images' data in a separate table, I guess you'd have to use PHP file system functions to get a list of files already uploaded (glob comes to mind, although there could be better functions or this).
EDIT:
There is also a very good AJAX file browser plugin - ckFinder, but I have very little experience with it and can't really comment on its workflow, but if you find it to be a more elegant solution, you should try it out.
if i could understand your question you want to associate the image with the event i.e tag the image with the event right ??
you can use jquery's attr() function to grab the src of img and put it in input field
I ended up storing the images in the database itself.
Saved some hassle on the file path side of things.

Select multiple Image and upload atonce using PHP

I am using PHP5 and I want to create multiple file uploader of type Image, in such a way that user could select different images while holding Ctrl button and click mouse left button (While user doing so all images will push in an array) and when ever he click to Uplaod button then all images would be upload.
This can't be done using a normal upload dialogue: It supports only one file at a time (this changes in HTML 5, but it isn't there yet). Take a look at Flash based uploaders like SWFUpload or Uploadify.
Have a look at:
Upload Multiple Images at Once using PHP

Image manipulation with JQuery and PHP

I want to do some kind of image editor, after I upload more images I make a list with all the thumbnails!
After, I want to be able to click on one thumb and rotate, duplicate, drag and drop (to change positions of the images), and delete the image. I want all the images to be in a php array. If an image is deleted I want to delete the row from array too. If a image is drag-and-dropped I want to change the position in the array too.
Ok, after the user uploads all the images and modifies some of them, how can I make a DONE button to save the positions of the images?
I made all ready all this, i only need to know how i can save the list of images after i "edit" with jquery? i need a save button or something
For this small project how do you suggest I save the images? (to make a table in mysql and store the names of the images in the database depending on the session id? depending on the IP?)
Any suggestions are welcome!
Way, waaay too all-encompassing question.
My suggestions:
Get familiar with gd or ImageMagick
Get familiar with jQuery UI, especially the drag & drop functionality
Store images in a temp folder on disk
Write a caching mechanism around it that'll clear the folder of unused images in regular intervals
Hashes can help to retrieve images from cache
Store state in a session
Do some work on this and come back with more specific questions.

Categories