Print INLINE Images/PIctures on reports

Print INLINE Images/PIctures on reports

Postby fman » Sat Nov 24, 2012 9:24 am

Keywords: FCKEDITOR, Upload Images, Pictures, Reports, Word, OpenOffice Writer, Open Office Writer

Picture/Images can available on reports ONLY When uploaded using FCKEDITOR (that manage display INLINE).
IMPORTANTE thing to remember
TestLink DOES NOT CREATE REAL WORD and/or ODT file, but uses the following OLD TRICK:
(Excerpt from: http://webcheatsheet.com/php/create_wor ... wordheader)

Using HTTP headers you need to format the HTML/PHP page using Word-friendly CSS and add header information to your PHP script.
Make sure you don't use external style sheets since everything should be in the same file.
As a result user will be prompted to download a file. This file will not be 100% "original" Word document, but it certainly will open in MS Word application. You can use this method both for Unix and Windows environments.

Example
<?php
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=document_name.doc");
echo "<html>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1252\">";
echo "<body>";
echo "<b>My first document</b>";
echo "</body>";
echo "</html>";
?>


This means that TL only generate HTML files then images/pictures ARE NOT EMBEDDED but include as LINKS.
And how the LINKS are created is the tricky part of all this issue.
Here the steps by steps config that will allow you to have ABSOLUTE URI with HTTP protocol instead of relative with FILE protocol.

HOW TO
This example use this scenario:
a. Linux platform
b. LAMPP
c. TestLink installed on /development/1.9.5.QA
d. upload directory ONLY FOR FCKEDITOR use /development/1.9.5.QA/fckuploads
e. URI To access TestLink : http://penelope.testlink.org:8080/development/1.9.5.QA
(IMPORTANT thing: all images used to explain the process has been taked accessing a TestLink installation
running browser on same server where TL was installed accessing through: http://localhost:8080)


1. use the configuration instruction for FCKEDITOR provided with TestLink Distribution (@ time of this writting file: Configuration_of_FCKEditor_and_CKFinder.pdf).

2. Configure
// Path to user files relative to the WEB SERVER document root (is not clearly explained at least IMHO, but can be an URI)
$Config['UserFilesPath'] = $_SESSION['basehref'] . '/fckuploads/' ; // $_SESSION['basehref'] is generated by TestLink Always.
$Config['UserFilesAbsolutePath'] = '/development/1.9.5.QA/fckuploads/';

Follow all other instructions present on pdf file.

3. Try uploading an image on a Test suite and you will get this screen:

https://docs.google.com/open?id=0B-hNfKQRC5a5MkdnaF9pZHY2aUE
https://docs.google.com/open?id=0B-hNfKQRC5a5QmJFZmVkVU9LU1k
https://docs.google.com/open?id=0B-hNfKQRC5a5aEhtSGpvczRUMHM

FINAL STEPS to be able to share the document WITH PICTURES EMBEDDED
If you create an Open Office or MSWORD report (REMEMBER file is STILL HTML), you need to proceed this way:

1. open the document
2. SAVE IMMEDIATELLY on NATIVE FORMAT ODT or DOC/DOCX.
3. On OPEN OFFICE (you will find reference for MS WORD below) use EDIT => LINKS.
(see following images:
https://docs.google.com/open?id=0B-hNfKQRC5a5WGhQaEVFcElTLTA
https://docs.google.com/open?id=0B-hNfKQRC5a5NGlVdDItMlV5cDg)
As you see LINKS are ABSOLUTE URI, a good thing because ANYONE in ANY PLACE of the world with ACCESS to the URI will see the images,
but WHAT ABOUT COPYING the doc on an USB KEY ?
Is betteris you TRANSFORM THIS LINKED IMAGES on EMBEDDED IMAGES.
ON OpenOffice you have to use BREAK LINKS, but ONLY AFTER YOU HAVE SAVE our (HTML) ODT in a REAL ODT.

References:
viewtopic.php?f=11&t=3583&hilit=word
http://forums.phplist.com/viewtopic.php?f=6&t=28375

Using Images/Pictures with FCKEditor DO AND DONT

1. Copy & paste of images seems to work BUT DOES NOT => do not use
2. In order to UPLOAD IMAGE to server, a directory accessible from webserver is NEEDED
=> using as destination the MORE SECURE configuration of 1.9.4 does not work => you can have TWO directories for UPLOAD
For secure docs => use NOT EXPOSED directory
To allow FCKEditor upload config has to be made on FCKEditor config.php (as explained in documentation provided with TL) BUT POINTING TO A directory INSIDE TL INSTALL DIR.

About Word (Created as XML) and embedded images
http://www.onemanwrites.co.uk/2009/03/1 ... word-2007/
http://superuser.com/questions/294978/t ... ded-images
fman
Member of TestLink Community
 
Posts: 3062
Joined: Tue Nov 15, 2005 7:19 am

Return to Reports



Who is online

Users browsing this forum: No registered users and 1 guest