PDF='MAIN' { ATTRIBUTES='*' { PLATFORM='php.txt'; REPTYPE='1'; ATTACHED='0'; PROJECT='36'; OBJECTNAME='resizedimage.php'; LIBLOBJ='WEBDEMO'; TITLE='resizedimage'; WEBPATH='http://esdi.excelsystems.com/wsexmpphp/'; TARGETPATH=''; FTPSITE='ESDI520'; SET='149'; VERSION='4.00'; CRTBNUM='Revision 3270'; CRTTEMPLT='C:\\Program Files\\ESDI\\WebSmart\\Temp\\PHP-Record Listing.tpl'; SAVBNUM='Revision 3270'; REPSYSTEM='ESDI520'; LASTLOC='0'; VHTML='N'; LASTSAVE='7/14/2008 08:48:41'; OBJLIBRARY='WEBTEST'; SOURCELIBR='WEBTEST'; SOURCEFILE='QRPGLESRC'; } FTPREFINFO='*' { URL='192.168.0.100'; INITIALDIR='/www/websmart/htdocs/wsphp/'; FTPPORT='21'; PASSIVEMODE='0'; WEBPATH='http://esdi.excelsystems.com/wsexmpphp/'; } FILES='*' { FILE='MU_ITMF' { LIBRARY='XL_WEBDEMO'; ALIAS=''; RCDFORMAT='R_ITMF '; LEVELID='1071025172821'; RFLEVELID=' '; EXTDS='0'; } } PANELS='*' { PANEL='ListHeader' { DESC='Page header'; DETAILS=' resizedimage

resizedimage

Description:   Example description.

'; } PANEL='ListDetails' { DESC='Page body'; ITERATIONS='10'; DETAILS=' '; } PANEL='ListFooter' { DESC='Page footer'; DETAILS='
Inventory Category Item Short Description Inventory Item Code Suggested List Price Image URL
$IMCAT $IMSDESC "; ?> $IMRETPRC $IMURL
  1. Start WebSmart go to File->New. In the new window select PHP Templates-> iSeries SQL-> Idaho->Record Listing.tpl .

  2. In the file library add MU_ITMF as the file and XL_WEBDEMO as the file library.

  3. In the field selection, select IMCAT, IMSDESC, IMITEM, IMRETPRC, IMURL and click finish.

  4. In the PHP-Source Code, where it says
    	$query = "select IMCAT, IMSDESC, IMITEM, IMRETPRC, IMURL  from XL_WEBDEMO/MU_ITMF";
    	     	
    Add:
    	where IMITEM >400 AND IMITEM<420 ORDER BY IMITEM desc
    	   
    So it looks like:
    	   
    	$query = "select IMCAT, IMSDESC, IMITEM, IMRETPRC, IMURL  from XL_WEBDEMO/MU_ITMF
    where IMITEM >400 AND IMITEM<420 ORDER BY IMITEM desc";

  5. Where it says // Global variables should be defined here
    Add:
    global  $IMURL, $width,  $height, $a, $b;

    So it looks like this:
    	// Global variables should be defined here
    global $IMURL, $width, $height, $a, $b;
  6. Immediately after $IMURL = $row["IMURL"];

    Add:
    	$a = \'http://esdi.excelsystems.com/websmart/wsdemo/musicstore/\'.trim($IMURL);
    	$b = "http://esdi.excelsystems.com/websmart/wsdemo/musicstore/no_photo.gif";
    	
    	$width = 50;
    	$height = 50;
    	
    	if (@$fp= fopen($a , "r")){
    		
    		
    	}
    	else{
    		$a=$b;
    	}
    		
    So it looks like:
    	$IMURL = $row["IMURL"];
    	$a = \'http://esdi.excelsystems.com/websmart/wsdemo/musicstore/\'.trim($IMURL);
    	$b = "http://esdi.excelsystems.com/websmart/wsdemo/musicstore/no_photo.gif";
    	
    	$width = 50;
    	$height = 50;
    	
    	if (@$fp= fopen($a , "r")){
    		
    		
    	}
    	else{
    		$a=$b;
    	}
    
        


  7. In the ListDetails tab,replace:
    	< td class="text"> $IMURL </td >
    	
    with the following:
    	< td class="text">
    	<?php
    	echo "<img width =$width  height = $height src=\\"$a\\">";
    	
    	?>
        
  8. Generate and launch.

Program Definition:   resized&replace.pdw

Rate This Example

Did this knowledge base article help you to achieve your goal?  Yes  No  Don\'t Know

Enter additional comments below.   If you want to hear back from us, include your contact information.

'; } } PREVIEWS='*' { PREVIEW='Main List' { SEG='ListHeader'; SEG='ListDetails' { REPEAT='10'; } SEG='ListFooter'; } } ACTIONS=' // Program Name: resized&replace.php // Program Title: resized&replace // Created by: RKB // Template family: Idaho // Template name: List All Records in File // Purpose: // Program Modifications: // DB Connection code require(\'/esdi/websmart/v6.6/include/xl_functions001.php\'); $options = array(\'i5_naming\' => DB2_I5_NAMING_ON); global $db2conn; $db2conn = xl_db2_connect($options); if(!$db2conn) { die(\'Failed to connect to database!\'); } global $wsnum; // This code is for the Rate this page section if (isset($_REQUEST[\'wsnum\'])) { $wsnum = $_REQUEST[\'wsnum\']; } // Check the cookie if(isset($_COOKIE[\'wsnumbc\'])) { $wsnum = $_COOKIE[\'wsnumbc\']; } else { setcookie(\'wsnumbc\', $wsnum); } // Global variable for calculated fields // Global variables should be defined here global $IMURL,$width, $height,$a,$b; // As a default task for this program, execute the display function if ($pf_task == \'default\') display(); /******************** End of mainline code ********************/ function display() { // Make all global variables available here foreach($GLOBALS as $arraykey=>$arrayvalue) { global $$arraykey; } $query = "select IMCAT, IMSDESC, IMITEM, IMRETPRC, IMURL from XL_WEBDEMO/MU_ITMF where IMITEM >400 AND IMITEM<420 ORDER BY IMITEM desc"; // Fetch rows for page: relative to initial cursor if (!($stmt = db2_exec($db2conn, $query))) { echo "Error ".db2_stmt_error() .":".db2_stmt_errormsg(). ""; die; } // Output header wrtseg("ListHeader"); while ($row = db2_fetch_assoc($stmt)) { // set color of the line xl_set_row_color(\'altcol1\', \'altcol2\'); $IMCAT = $row["IMCAT"]; $IMSDESC = $row["IMSDESC"]; $IMITEM = $row["IMITEM"]; $IMRETPRC = $row["IMRETPRC"]; $IMURL = $row["IMURL"]; $a = \'http://esdi.excelsystems.com/websmart/wsdemo/musicstore/\'.trim($IMURL); $b = "http://esdi.excelsystems.com/websmart/wsdemo/musicstore/no_photo.gif"; $width = 50; $height = 50; if (@$fp= fopen($a , "r")){ } else{ $a=$b; } wrtseg("ListDetails"); } // closet the database connection db2_close($db2conn); wrtseg("ListFooter"); } '; }