Quote from: jad889nb at Feb 27, 2009, 05:26 PM
Do you think that running your suggested solution inside of a loop that processes each picture, inside a loop that processes each item will be too much of a performance hit?
It’s not a performance hit, but the script takes some time to process, so be sure to set your server so that it doesn’t exceed the max running time of a script.
Quote from: jad889nb at Feb 27, 2009, 05:26 PM
To expand on your “note”. If I want to drop 10 pictures into a gallery (/assets/galleries/<docid>) and then resync, I need to make sure that my description/title adding script knows that I added 10 pictures and references the DB rows based on that. i.e. If 10 pictures, query script looks at max (id), then goes back 10 rows and starts adding the desc/title, working its way back to the most recent entry. All of that would be inside a loop that works its way through the individual items.
Yes, that’s what I mean.. Or another option would be to find the picture from maxigallery database after resynch with the picture filename. MaxiGallery cleans the filenames using
this, so if you are uploading images that and needs cleaning, you need to run the original image through same kind of logic (eg. [URL=http://mirror3.cvsdude.com/trac/doze/MaxiGallery/browser/trunk/assets/snippets/maxigallery/maxigallery.class.inc.php#L821]this) to know what the destination filename will be.. But maxigallery also adds a number to the end of the filename if file already exists in the gallery, so you need to take that into account also, if your picture filenames aren’t unique.. But if your files are with unique names and do not have any special characters, then maxigallery wont do anything with the filenames and you can easily use that to find the db row from maxigallery db table.
Quote from: jad889nb at Feb 27, 2009, 05:26 PM
My largest concern is that this whole process is going to be very slow. The picture files are likely to be over 25 megabytes. Your thoughts on which method would be most efficient will be much appreciated. Should I be looking at a totally different approach to this problem, or in your opinion is this a feasible approach?
Well.. It doesn’t really matter if you do your script to run each picture in a loop one by one, or if you add more pictures to the galleries at the same time and update titles.. There will be some performance advantage, if you make it so that all pictures to be uploaded are added to the filesystem folder and then resynch and then update the title / descriptions.. But the main thing here is the very long running time of the script. Especially if you have large picture files, it takes a while for maxigallery to resize the thumbnails and so on.. so you need to have enough running time set for the php scripts in php configuration.. You need to do some testing that how long it will take to process.. The processing itself may possibly have some effect also to the server so that serving of pages during the process will be a littlebit slower, but I guess these kind of updates doesn’t happen very often so I wouldn’t think about it very much.. also it would be good to automate the process to do updating during night time etc. You could even automate it to take the site offline for the duration of the automated update, so clients accessing the site would get information that update is in progress..
In any case, you need to just test and see how it’ll go..
The best way in my opinion would be to create a script that handles just one picture at a time, then create an ajax updater page that will request one picture to be uploaded and wait for it’s completition, then request another one etc etc.. That way you would have to have the server maximum script processing time and memory limits to be enough for just to process one picture to the database. If you do the loop in php side, you need to have the max processing time and memory limits for the duration of uploading all pictures..
So I would suggest to start with a script that updates one picture from the xml file to maxigallery and then after you have that working, think about adding ajax requester for it.. so ajax parses the xml file contents and asks php script one by one to add the files.