Ivan Simonov [ivansimonov]

Created on 23 January 2010, over 14 years ago
Updated 16 April 2023, over 1 year ago

CVS edit link for Ivan Simonov

I successfully use Drupal for a long time and I would like to make contribution to the community.
Some time I wrote "randomimage" module for Drupal 5. Then I adapt it for Drupal 6.
I use this module on my site to show faces of our employees and their names and titles in block.
Friends ask me about this module and I decide rewrite it and publish.
I change conception of this module to use more standard Drupal functions.
For example "randomimage" depends of "upload" module for uploading pictures.
I recommend to install also http://drupal.org/project/upload_preview module.
Module adds 1 block, 1 page and 1 permission (viewing this page).
If you need more blocks (and pages), you can add them from the administrative interface of 1st block.
Also you can select node with uploaded images to be shown in the block.
If permissions is set users can click to block image and go to the page represents all pictures shown in this block.
In my case it useful when I want to show all staff photos with names and titles. They sorted randomly.

I know about http://drupal.org/project/random_images module
But It has not needed functionality.
This module exist only for Drupal 5 and not updated since 2007-Nov-28.

It is possible to use my module like next version of "random_images" module. Why not? :)

Actually it was start from PHP snippet:

  // Depends on upload module
  $nid= 2;  // Node ID with pictures uploaded
  $width = 200;  // Desirable picture width
  global $base_path;
  $node = node_load($nid);
  if (count($node->files)>0):
    $index = array_rand ($node->files);
    $filename = ($node->files[$index]->filename);
    $filepath = ($base_path . $node->files[$index]->filepath);
    $description = ($node->files[$index]->description);
    print "<center>";
    print "<img src='$filepath' width ='$width' alt='$filename'><br>";
    print filter_xss($description, $allowed_tags = array('a', 'em', 'strong', 'cite', 'code', 'ul', 'ol', 'li', 'dl', 'dt', 'dd', 'img', 'br', 'hr' ));
    print "</center>";
  endif;

And something like this for page with all uploaded images.
Snippet good for some people, but to manage it you must have at least Use PHP filter permission.
To increase flexibility and automatize it I decide to make this module and share it.

I have another one module which uses actions mechanism and send to desired account alerts via Jabber protocol.
But I am not ready yet to send it.

Have a nice day,
Ivan.

📌 Task
Status

Fixed

Component

co-maintainer application

Created by

🇷🇺Russia Ivan Simonov

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024