Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Plugin request: Image Batch Upload
Yeah you know what, I completely switched off :P it’s so hot in this room and my skin is boiling. I am familiar with shell access, as a MS-DOS user, plus I still have to use telnet to configure routers and blah blah. I just haven’t used cygwin before.
Ok now that we’ve established I need to know the above, is it very simple to load the script? Each program tends to require diff cmds so, it looks simple enough I just need to know the code, the line and how to run the script with this. I tried echo and sure enough it works, tried run but it doesn’t exist. exec? launch?
EDIT:
<pre>Use of PuTTY, PSCP, PSFTP and Plink is illegal in countries where encryption is outlawed. I believe it is legal to use PuTTY, PSCP, PSFTP and Plink in England
Use of the Telnet-only binary (PuTTYtel) is unrestricted by any cryptography laws.</pre>
Bloody hell, so I take it I can’t use PuTTytel for this job, I’m still connecting tot he server right?
Last edited by sekhu (2005-05-27 22:25:55)
Offline
Re: Plugin request: Image Batch Upload
ah, I am sorry, I didn’t know what level you were on and hadn’t read the last few comments. :)
In the setup.exe when you get to Select Packages
Open “Base” and check that sed is selected.
Open “Web” and check that curl is selected.
- - Go into the directory where the images are that you want to upload (using explorer).
- - Create a text-file: upload.sh
- - Edit the file in an editor and copy and paste the script.
- - Adjust the first three variables [1]
- - Now start Cygwin shell
- - If the directory with the images is C:\images on the prompt type: cd /cygdrive/c/images [2]
- - Type ./upload.sh hit enter and wait.
[1] if your loginname or passwords contains non-alphanumerical characters, you may want to create a new user for this in Textpattern)
[2] There is a utility called cygpath that will convert windows to cygwin paths, very helpful for long pathnames. cygpath “C:\test”
edit: This script will run on your own computer at home, you don’t need any special access to your server to do this. Just make sure your firewall is not blocking any outgoing traffic.
Last edited by Sencer (2005-05-27 22:32:24)
Offline
Re: Plugin request: Image Batch Upload
so far so good I think, it’s running after entering .upload but just waiting – what’s the usual deal? Does the cursor sit there flashing until it’s complete then output a message? There’s about 20mb of images, and I have 256k upload -so even then I know it will take sometime, but is there any way I can find out if anything is actually being uploaded?
EDIT: Looks like I didn’t get it work correctly, it sat there for ages thinking, but nothing uploaded. Bugger
Last edited by sekhu (2005-05-27 23:37:40)
Offline
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