Making pictures automatic fit into Greybox style

Had your computer crash on you, or a website shows wrong, or your printer went dead on you? Come on in...

Moderator: Crew

User avatar
Chroelle
Admin emeritus
Posts: 9870
Joined: Fri Feb 17, 2006 9:19
Location: Location, location...

Making pictures automatic fit into Greybox style

Post by Chroelle »

Well I have an issue at work, where a lot of pictures have been taken during the summer, and they have to be uploaded to the homepage, so the parents can see them. I started using Greybox (http://orangoo.com/labs/GreyBox/) during summer, and I am the only one able to do any coding at my workplace. I had a coworker learn step by step what to do to put pics on the HP, but nothing more about why or whatelse. Now I would love it if I could make a code that would make it automatic so pics added to a page gets written into Greybox automatic. It needs to be said that it should be:
1) able to read which directory (folder) the pics are placed in.
2) able to read the amount of pics so it would automatically add all pics, and not just a preset number of pics. Even if the images were called different things from time to time. One batch could be image 1-25.gif and the next could be my summervacation1-57.jpg
3) able to work rather easily.

I will try to work out after this how I can make it so a website is made automatically whenever a folder is made in a particular gallery.
And then how to make a link appear automatically on a specific location to the new gallery.

CAn anybody help me with this. I am not talking about doing it for me, but learning me how. I need to understand the hows, and whys so I can fix it if it breaks. And trust me in the hands of me it will eventually break. :D
Currently testing Life version 2.9 (With added second child)
(Beta testing in progress)

www.paed-it.dk - My blog in Danish

Clothes make the man. Naked people have little or no influence on society.
--Mark Twain
User avatar
Pager
Winner of CWF review contest!
Posts: 1249
Joined: Mon May 01, 2006 15:54
Location: Berlin, Ontario

Post by Pager »

I've never used Greybox...What are the steps for adding the pics to Greybox?

It looks to me like you'd just need to write it in Html...or something.

If you get me an example of that, I might be able to investigate better.
CWF - Safer than Crack, Twice as Addicting
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

Gne..

So did I understand it correctly. You need a script which asks user to write a name of directory where pics are. Then it should read the contents of the directory, and write a file with certain tags?

Could you please give me a detailed explanation about what the script should do? I mean if we assume we have a folder called foo at our server, with pictures 1.jpg and 2.jpg. What kind of a file should be produced?
User avatar
Chroelle
Admin emeritus
Posts: 9870
Joined: Fri Feb 17, 2006 9:19
Location: Location, location...

Post by Chroelle »

I can link you to something that might help. A site I did that uses Greybox.
http://www.sfo-fu.dk/Sommerferie%202007.htm

You can see what kind of code needs producing there. This line is pretty much the important one:

Code: Select all

<a rel="gb_imageset[Regntur]" title="Afsted mod stranden" href="Fotogalleri/Sommerferie%202007/Sommerferie%20002.jpg">
   <img src="Fotogalleri/Sommerferie%202007/Sommerferie%20002_small.jpg" width="100" height="75" />
   </a>
Could you please give me a detailed explanation about what the script should do? I mean if we assume we have a folder called foo at our server, with pictures 1.jpg and 2.jpg. What kind of a file should be produced?
Code should then be written automagically:

Code: Select all

<a rel="gb_imageset[Regntur]" title="Afsted mod stranden" href="Foo/1.jpg">
   <img src="Foo/1_small.jpg" width="100" height="75" />
   </a>
And for 2.jpg:

Code: Select all

<a rel="gb_imageset[Regntur]" title="Afsted mod stranden" href="Foo/2.jpg">
   <img src="Foo/2_small.jpg" width="100" height="75" />
   </a>
And the ubercool thing would be if it could at the same time create the 1_small.jpg file, so one wouldn't have to do that too.

To get the site to use greybox one needs to have greybox-scripts uploaded to ones server.

That is where this code comes in:

Code: Select all

<script type="text/javascript">
    var GB_ROOT_DIR = "http://sfo-fu.dk/";
</script>
<script type="text/javascript" src="greybox/greybox/AJS.js"></script>
<script type="text/javascript" src="greybox/greybox/AJS_fx.js"></script>
<script type="text/javascript" src="greybox/greybox/gb_scripts.js"></script>
<link href="greybox/greybox/gb_styles.css" rel="stylesheet" type="text/css" />
Does this make any sense. I have a feeling it is actually not that hard, but I have no idea what to do or where to start. It would just make my work sooooo much easier. I have more scripts ready for being done in the back of my head that will do a lot of difference too.
Currently testing Life version 2.9 (With added second child)
(Beta testing in progress)

www.paed-it.dk - My blog in Danish

Clothes make the man. Naked people have little or no influence on society.
--Mark Twain
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

I doubt you need to actually do the smaller scale images. Usually width="" and height="" parametres in image tag, will shrink larger image to be displayed as a lil one :)

(Of course that wastes bandwidth because large image is sent, browsers just shrink it. May be different in your case though).

Anyways, I did a small c++ code snippet for you. But since I do not have Windows on my machine atm, you need to compile it... (Or I can compile it for you when I have access to windows machine). Unfortunately I had no chance to test it works correctly under windows. Possible problems are usage of \ character between folder names (linux uses /) and the location of system() function. Oh, and I am not sure if the > on commandline works for directing writings from stdout to file on windows either.... So this may not work, but if you have a C++ compiler at hands, it is worth of trying :)
You do not have the required permissions to view the files attached to this post.
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

Well, here's the proggie compiled for windows. download it to the computer where you have the images (I assume you do have them on the local comp).

open command prompt and run it from there.

You'll get the instructions. Follow them, and check the resulting file. If it is not Ok, contact me :)

Note that there is a template file inside the package, it can be modified according to the instructions I gave.. Any questions? Well, ask :)
You do not have the required permissions to view the files attached to this post.
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

Note that the C++ is not the optimal language for tasks like this, due to the fact that it needs to be re-compiled each time the code is changed. Compiled program also has limitations what comes to operating systems... Not to mention the fact that with bash scripts for example, this task would have been ... well, many times easier.
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

There's a bug I just did while I added a param... I'll upload corrected version :D
User avatar
Chroelle
Admin emeritus
Posts: 9870
Joined: Fri Feb 17, 2006 9:19
Location: Location, location...

Post by Chroelle »

I will try and look at it when you upload it. Thanks a bunch for doing such work for me. I have absolutely no experince or knowledge of C++.
I cant wait to test it.

Heck I will download the first version you placed here and see how it goes from there. I might have hundreds of questions in a bit.
Currently testing Life version 2.9 (With added second child)
(Beta testing in progress)

www.paed-it.dk - My blog in Danish

Clothes make the man. Naked people have little or no influence on society.
--Mark Twain
User avatar
Chroelle
Admin emeritus
Posts: 9870
Joined: Fri Feb 17, 2006 9:19
Location: Location, location...

Post by Chroelle »

1: The program wont run. When I press it, it snaps open and shut again. So nothing happens. I figured that maybe it produced a template file, but nothing is being produced.
2: What does it do when pressed normally.
Currently testing Life version 2.9 (With added second child)
(Beta testing in progress)

www.paed-it.dk - My blog in Danish

Clothes make the man. Naked people have little or no influence on society.
--Mark Twain
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

Last? frigging attempt :D
You do not have the required permissions to view the files attached to this post.
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

Run it from command prompt to see the output (not by clicking the image). Otherwise it'll just close the window so quickly one does not see the outputs.
User avatar
Chroelle
Admin emeritus
Posts: 9870
Joined: Fri Feb 17, 2006 9:19
Location: Location, location...

Post by Chroelle »

Do I understand correctly:
Instead of just typing doimagefile.exe after finding the folder it resides in, I should also point out:
- what folder the pictures are in (on the server?/on my pc?).
- What folder the template file is in (What template is this?) (Is it the one in curlyscript)?
- What I want the folder(/gallery) to be called.
- I also dont undertand what Http-folder I should point to. The root or...?

:rolleyes: I am not used to working in Command prompt. :hammer:
Currently testing Life version 2.9 (With added second child)
(Beta testing in progress)

www.paed-it.dk - My blog in Danish

Clothes make the man. Naked people have little or no influence on society.
--Mark Twain
User avatar
Chroelle
Admin emeritus
Posts: 9870
Joined: Fri Feb 17, 2006 9:19
Location: Location, location...

Post by Chroelle »

BTW: When I just typed doimagefile.exe after finding the right folder, still nothing open up.
Currently testing Life version 2.9 (With added second child)
(Beta testing in progress)

www.paed-it.dk - My blog in Danish

Clothes make the man. Naked people have little or no influence on society.
--Mark Twain
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

Did you take the new version?
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

curlyscript2.rar (downloaded 0 times) ;)
User avatar
Chroelle
Admin emeritus
Posts: 9870
Joined: Fri Feb 17, 2006 9:19
Location: Location, location...

Post by Chroelle »

I missed that post. I think I pressed the icon for view last post, and you wrote two while I was gone :D
MY bad. I have downloaded it now. I will test it now.
Currently testing Life version 2.9 (With added second child)
(Beta testing in progress)

www.paed-it.dk - My blog in Danish

Clothes make the man. Naked people have little or no influence on society.
--Mark Twain
User avatar
Chroelle
Admin emeritus
Posts: 9870
Joined: Fri Feb 17, 2006 9:19
Location: Location, location...

Post by Chroelle »

Nothing opens still. I get this line of text shown in the screenshot.

I still dont know if I should write the location of Greybox on the server, since it works serverside, but not on my computer alone. You placed a shortcut pointing to my c-drive so I am rather confused.
The reason you are working in C++ instead of doing this in PHP/javascript is that because you found out that it could not be done via PHP or because you are more at home in C++?
I must admit it feels like I dont understand something basic here... I am afraid you might have to really spell it out for me. Classic step-by-step.
You do not have the required permissions to view the files attached to this post.
Currently testing Life version 2.9 (With added second child)
(Beta testing in progress)

www.paed-it.dk - My blog in Danish

Clothes make the man. Naked people have little or no influence on society.
--Mark Twain
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

Oh, I see :) Problem is simple. If you give commandline arguments which have spaces (as folder Documents and settings), you need to use quotes " " around the argument. Othervice they are interpreted as separate arguments. (That's a general way :) )

So try:
doImageFile.exe "C:\Documents and Settings\Chtistian Toft\My Documents\My Pictures\skal sorteres" "C:\Documents and Settings\Chtistian Toft\My Documents\My Pictures\skal sorteres\template.txt" outputscript.html http://whatevertheservernamewas/folderw ... beonserver

That is assuming you placed template.txt (which was in the package) to folder:
C:\Documents and Settings\Chtistian Toft\My Documents\My Pictures\skal sorteres

and assuming the images are in the same folder.

This should create file called outputscript.html with the image text.
User avatar
Maz
Admin emeritus
Posts: 1938
Joined: Thu Mar 16, 2006 21:11
Location: In the deepest ShadowS

Post by Maz »

I can edit the code so it will be asking the folders one by one while being executed, but that will make it unusable in conjunction with other programs/batch files.