Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Plugin request: Image Batch Upload
Wow, 20 MB. Yeah, it just sits there until all of it is done. I am not sure, but I think you should avoid logging into or moving around in textpattern during the upload. Textpattern stores a “nonce” in the database which, I think, is regenerated on each login. Thus moving around in textpattern might invalidate the Cookie-nonce that the script is using. The script is dumb, so it doesn’t even check wether anything was successful or not, it just keeps firing those requests. :)
If you’ve already logged into textpattern, then you can just look inside the textpattern-images section and see if it uploaded anything, and restart the script if you want.
It will overwrite (i.e. re-upload) previously uploaded files, so you should make sure you have the only the necessary images in the directory. :)
It’s very hackish, I admit. :P
edit: Ok, then you should try it with jsut one or two images at a time. My assumption is, that maybe your login name and or your password has characters in it, that are not url-safe. Can you create a user with a simple123 name and simpler234 password and try with that?
Last edited by Sencer (2005-05-27 23:39:57)
Offline
Re: Plugin request: Image Batch Upload
fair enough – well I haven’t got it to work thus far – not sure what the reason is, I think I pretty much followed the rules, didn’t login to txp either, but could it be the size of the upload? i mean each file is x amount which totals up to 20mb for all the images.
EDIT: will try what you suggest in your edit and report back. Cheers
Last edited by sekhu (2005-05-27 23:41:33)
Offline
Re: Plugin request: Image Batch Upload
well no joy at this end – i created a folder called test, a new alphanumeric username and pass, and included two small images – i then added the upload.sh and edited it appropriately.
in cygwin i went to the dir, and entered ./upload.sh and it still just remains there, blinking at me, laughing at me. not sure what else I can do to get this to work. My host has enabled ssh for me, even after I told them that I can’t use it due to the laws in my country (bloody MI5).
so what could be the cause? Firewall is allowing full access to all componets of cygwin, so not sure.
my other thought was if I could ftp the images over to the images dir, and then run a script to tell txp to recognise any new images it may find in that dir?
EDIT: thought it might be as I use a sub dir, so I added that in the path but still no joy with either main account or second dummy account. the second time it seems to just quickly to dos omething then go back to prompt
Last edited by sekhu (2005-05-28 01:08:22)
Offline
Re: Plugin request: Image Batch Upload
What do you get at the command line, when you run this:
<b><notextile><pre>
curl -D – -d “p_userid=$LOGIN&p_password=$PASS” $URL | head -n10</pre></notextile></b>
(Please replace the variables (including the dollar signs) with their respective values)
Is there a Set-Cookie Line in the response?
Offline
Re: Plugin request: Image Batch Upload
Hmm quite complicated…..
This is the critical point though: when you use this process, does txp register and label all the images, like it normally does when you upload?
If it does, I will definitely work this out.
If it doesn’t….you may as well use an ftp client.
Offline
Re: Plugin request: Image Batch Upload
You are right, jameslomax. If it didn’t do that it would be pretty pointless. What it does is equivalent to you uploading the images from the images-list in the admin-panel. It does not do any of the additional things that are optional, on the second page after the upload.
edit: I updated the script to do some very basic checking, if the login is succesfull and abort otherwise. Also added a rudimentary progressmeter (echo name of current file).
Last edited by Sencer (2005-05-28 09:31:16)
Offline
Re: Plugin request: Image Batch Upload
> Sencer wrote:
> What do you get at the command line, when you run this:
<b><notextile><pre>
curl -D – -d “p_userid=$LOGIN&p_password=$PASS” $URL | head -n10</pre></notextile></b>
(Please replace the variables (including the dollar signs) with their respective values)
Is there a Set-Cookie Line in the response?
I can’t run that cmd line…I can’t find the | key on the keyboard, the key that’s supposed to be that is either # or with shift this ~. I know I can’t copy and paste :(. Well I’ll try that new script.
Additionally, to clarify – in the script do I also change the pass/login etc with $ signs as well as at the top, and should I also include the full path to the images dir, or simply to the dir that contains txtpattern?
I’ll try all of em :)
EDIT: First error I got was “Can’t Login” :) At least it’s something.
EDIT2: tried to login using the first and second account, tried adding the full path, and so on. No luck as of yet. Firewall is enabled to allow access.
Last edited by sekhu (2005-05-28 11:41:43)
Offline
Re: Plugin request: Image Batch Upload
>Additionally, to clarify – in the script do I also change the pass/login etc
yes
> with $ signs as well
no
THING=‘something’ is a variable definition. $THING is using that variable.
> or simply to the dir that contains txtpattern?
that’s correct, or more specifically to the admin-directory of your installation.
btw: I tried copy and pasting the pipe symbol and it worked. It may appear with a “break” in the middle on some keyboards (so it is two little vertical bars). On a german keyboard it is shift + >, on an english keyboard, I think, it is near the / or \ character. You may try to combine any symbol on your computer with shift, or alt, or altgr.
Offline
Re: Plugin request: Image Batch Upload
i don’t even have the reverse / symbol on this BLOODY keyboard.
anyway, i’ve tried a lot of variations and not having much luck. Anyway you can try this for my account? As I keep getting can’t login, I assume it’s cookei related, but how do I resolve it?
Last edited by sekhu (2005-05-28 11:47:19)
Offline
Re: Plugin request: Image Batch Upload
sekhu, I sent you an E-Mail. It is probably more productive, if we solve the problem via E-Mail and then post the solution.
Offline
Re: Plugin request: Image Batch Upload
OK so it wont do any of the ‘second page’ options…..so it wont automatically create thumbnails?
I need thumbs for my archives.
Alternative: I could create them in photoshop. Problem with that though….will this script associate the main image with the thumb, or place them together because their name will be almost identical? I need them to be together, when i insert them in the article entry and excerpt fields.
Offline
Re: Plugin request: Image Batch Upload
I see, no the script is not doing that. Since I gather you want something that you can keep using on a day to day basis, a shell script may not be your best option anyway. But if somone else wants to extend the snippet to do that, feel free. :)
Offline
Re: Plugin request: Image Batch Upload
Yes, my day-today work is being managed OK at the moment.
However, at some point I envisage needing bulk image handling.
Offline
Re: Plugin request: Image Batch Upload
ok thanks to sencer I got it working. The script needed a slash at the end of the url :)
Secondly, if you have glx_admin_image plugin (the one that lets you resize an image on upload) and you have a setting already in there for a resize, using the script to upload a large image will also create the thumbnail image for you. Now that’s what ti’s doing for me, so don’t hold me to it, But I’ve tried several test images, and they all auto-thumbnailed as wel as keeping the original
Offline
#30 2005-06-20 01:58:14
- domfucssion
- Plugin Author
- Registered: 2004-10-23
- Posts: 39
Re: Plugin request: Image Batch Upload
hi,
i tried for a while to get this to work and eventually resorted to reading man curl. I am on osx using bash and it would not work (everything ran, just didn’t do the upload) – until I changed the -H “Cookie: $COOKIE” to -b “txp_login=loginnameencodedcookie”
anyone know why sencer’s original curl shouldn’t just work for me?
Offline