I need to show images thumbnails inside the report and show fulls ize images when click on it (just like a little gallery)... What I did so far is this: I have replaced (in beta3) line 515 (function _webform_report_format_data) looks so:
$link = '<a class="showup" href="' . base_path() . $tmp['filepath'] . '">' . $tmp['filename']. ' (' .(int) ($tmp['filesize']/1024).' KB'. '</a>';
I replaced with this:

$lnk=base_path() . $tmp['filepath'];
$link = '<a class="fancybox_class" href="'.$lnk.'"><img width="40" src="'.$lnk.'"><br>('. (int) ($tmp['filesize'] / 1024).' KB'.'</a>';

considering that I have fancybox installed and working. Russian reference is here http://digger3d.com/index.php/page/drupal-webform-report-fancybox-image/...
My question is:
Am I opening a security hole?
Is it any way to make it without the patching the original webform_report files? Am I inventing a bicycle?

Comments

jimbullington’s picture

Am I opening a security hole?

I'm not sure - Drupal has several articles on filtering text input, but I'm not sure about uploaded images.

Is it any way to make it without the patching the original webform_report files?

At this time, it is not possible to do this without patching.

Am I inventing a bicycle?

I'm not sure what you mean by this...

digger3d’s picture

I'm not sure what you mean by this...
I mean am I doing something that someone else did before, when is much easier take that what was done already...

jimbullington’s picture

OK - stupid me - I should have figured that out.

To my knowledge, this has not been done before in webform reports. I am not sure this would be appropriate for the module, due to security concerns in displaying uploaded images from anonymous (untrusted) users.

Or am I being overly cautious? It may be possible to add code that would check file extensions for file uploads and wrap the download link around an image tag for image file types - as you have done.

digger3d’s picture

The only thing that I want to have is to have a gallery inside there, not just one image.... Any ideas?

jimbullington’s picture

Do you mean format the report more like a grid instead of a list?

If you created a report with one column - the image component - could you insert something like this into _webform_report_pager()?

...
// Add the css file for form display.
drupal_add_css(drupal_get_path('module', 'webform_report') . '/webform_report.css');

// turn the $rows list into a grid
$colsperrow = 10;   // number of columns per row

// span header
$headers[0]['colspan'] = $colsperrow;

// build grid - assumes one column per row coming in
$grid = array();
$grow = 0;
$gcol = 0;
for ($i=0; $i<count($rows); $i++) {
  $grid[$grow][$gcol++] = $rows[$i][0]['data'];
  if ($gcol == $colsperrow) {
    $grow++;
    $gcol = 0;
  }
}
// set output to grid
$rows = $grid;

// Break the array into chunks for pagination.
if ($results_per_page != 0) {
...

I have not tested this...

digger3d’s picture

no, it is like i have to add many photos int one weform... like a gallery inside one field... I will test what you sent

digger3d’s picture

it joined 1st cell of 3 submissions into one cell, besides it wasn't a photo cell....

digger3d’s picture

i have a regular webform, about 25 cells and one cell is for images... I need to put a gallery into this cell... let user upload up to 7 images into a small gallery....

jimbullington’s picture

I'm sorry - I just do not see how you can do what you are describing with webform and webform_reports.

Maybe use CCK and make a new node type with a several imagefields?

jimbullington’s picture

Status: Active » Closed (won't fix)