[Imc-uk-useability] question regarding startpage photograph

WietsE wietse at indymedia.org
Thu Feb 1 12:27:23 PST 2007


Hiya,

During the meet up in IRC we talked about the selected photo option for 
the startpage, like NYC Indymedia have (http://nyc.indymedia.org). As 
agreed I emailed them and here's the response. Below I've pasted the 
technical stuff Mike from NYC sent me aswell.

Cheers, Wietse


mike topper wrote:
> sure, i can explain how it works.  I'm the one that wrote it.   I'll 
> answer your quiestions now and i'll post how its actually implemented 
> today when I have time.
>
> WietsE wrote:
>>
>> 1. Do you select the photo manually?
>>
>>   
> kind of.  Basically we have a "media folder" (in mir) with all the 
> images we want to appear, it selects a random one of these on pageload
>
>
>> 2. Is it done automatically?
>>   
> kind of.  the only thing that needs to be done manually is adding the 
> image to the media folder.  everything else is done by mir/apache
>> 3. Is the caption that of the article or the photo?
>>   
> the caption is of the photo.
>> 4. How long does it normally stay up before you select a new one?
>>   
>
> we try to cycle through to have a full new set of images every week or 
> two.  sometimes they stay up longer than that.
>
>
> -Mike

and he also wrote:

so the media box is a combination of apache modrewrite module and mir.

here is the steps to setting up a photo box for yourself with mir:

1.  Create a media folder that you want to use for the images that will 
be displayed in your photo box. Call it whatever you want.  ours is 
called frontpage i think.  it doesn't matter

2.  Add a producer to your producers.xml file to generate the mapping 
for the photo folder.  you will need to change to 
selection="to_media_folder=8" to whatever id your newly created media 
folder is.


<producer name="generatefpincludes">
  <verbs>
    <verb name="doit" />
  </verbs>
  <body>

       <Set key="counter" value="1"/>
     <Enumerate key="fpimage" table="image" selection="to_media_folder=8 
and is_published=true" >
       <Log message="generating include for image id: ${fpimage.id}" 
type="info" />

         <Generate
               generator="/fpinclude.template"
               
destination="${config.storageRoot}/fpincludes/${fpimage.id}.inc" />
      <Set key="counter" value="counter+1" />
     </Enumerate>


          <List key="fpincludes" table="image" 
selection="to_media_folder=8 and is_published=true" />
               <Generate
                       generator="/fpmapping.template"
                       
destination="${config.storageRoot}/fpincludes/map.txt" />

   </body>
 </producer>

3.  add in the two templates you will need for creation of the includes 
and the mapping:

they are fpmapping.template and fpinclude.template

you can find both of these in NYCs cvs repository on codecoop.

4.  Edit your apache config file and add the following inside of your 
virtualhost. change path to wherever your site code is stored
 # rewrite rule for random includes
 RewriteEngine On
 RewriteMap random-map rnd:/home/nyc/nyc.indymedia.org/fpincludes/map.txt
 RewriteRule /fpincludes/(.*\.rand) /fpincludes/${random-map:$1}


5.  put the code to display the image in the startpage template or 
whatever template you want to use:

                 <!--#include virtual="/fpincludes/fpimage.rand" -->


and thats it!!

let me know if you have any questions.


More information about the Imc-uk-useability mailing list