unable to save looped data from excel in cakephp - php

$inputFileName = $_FILES["file"]["tmp_name"];
$objReader = PHPExcel_IOFactory::createReader('Excel5');
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($inputFileName);
$objWorksheet = $objPHPExcel->getActiveSheet();
$highestRow = $objWorksheet->getHighestRow(); // e.g. 10
$highestColumn = $objWorksheet->getHighestColumn(); // e.g 'F'
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); // e.g. 5
$Player_name = '';
$Activity_name = '';
$Domain_id = '';
$Activity_description = '';
$Activity_date;
$player_id_owner = '';
$DomainCount = '';
echo '<table>' . "\n";
for ($row = 5; $row <= $highestRow -1; ++$row)
{
echo '<tr>' . "\n";
for ($col = 0; $col <= $highestColumnIndex; ++$col)
{
echo '<td>' . $objWorksheet->getCellByColumnAndRow($col, $row)->getValue() . '</td>' . "\n";
$Domain_name = $objWorksheet->getCellByColumnAndRow(0, $row)->getValue();
$Activity_name = $objWorksheet->getCellByColumnAndRow(1, $row)->getValue();
$Activity_description = $objWorksheet->getCellByColumnAndRow(2, $row)->getValue();
$Player_name = $objWorksheet->getCellByColumnAndRow(8, $row)->getValue();
$Activity_date = $objWorksheet->getCellByColumnAndRow(10, $row)->getFormattedValue();
echo '</tr>' . "\n";
echo '</table>' . "\n";
}
$playerCount = $this->PlayerCount($Player_name);
echo "Current player name is: ".$Player_name;
echo "Current player count is: ".$playerCount;
if($playerCount == 0)
{
$email = str_replace(' ', '', "$Player_name#nsn.com");
$player_type_id = 2;
$password = "password123";
$this->Activity->create('Player');
$this->request->data['name'] = $Player_name;
$this->request->data['player_type_id'] = $player_type_id;
$this->request->data['email'] = $email;
$this->request->data['password'] = $password;
if ($this->Player->save($this->request->data))
{
$this->flashSuccess(__('Player saved successfully!'. $Player_name));
echo ("Player saved successfully!". $Player_name);
}
else
{
$this->flashError(__('Error while trying to save Player.'));
debug($this->Activity->validationErrors);
}
}
$color = "#99CCFF";
$abbr = "TD";
$description = $Domain_name;
$player_type_id = 1;
$player_id_owner = $this->findPlayerId($Player_name);
//$player_id_owner = $this->Activity->findId($Player_name);
//echo h($id = $player_id_owner['Player']['id'] );
//debug($player_id_owner);
echo "Current Domain name is: ".$Domain_name;
$domainCount = $this->DomainCount($Domain_name);
echo "Current Domain count is: ".$domainCount;
if($domainCount == 0)
{
$inactive = 0;
$this->Activity->create('Domain');
$this->request->data['name'] = $Domain_name;
$this->request->data['color'] = $color;
$this->request->data['abbr'] = $abbr;
$this->request->data['icon'] = 'fa fa-bolt';
$this->request->data['description'] = $description;
$this->request->data['player_type_id'] = $player_type_id;
$this->request->data['player_id_owner'] = $player_id_owner['Player']['id'] ;
$this->request->data['inactive'] = $inactive;
if ($this->Domain->save($this->request->data))
{
$this->flashSuccess(__('Domain saved successfully!'. $Domain_name));
echo ("Domain saved successfully!". $Domain_name);
}
else
{
$this->flashError(__('Error while trying to save domain.'));
debug($this->Activity->validationErrors);
}
}
$activityCount = $this->ActivityCount($Activity_name);
echo "Current activity name is: ".$Activity_name;
echo "Current Activity count is: ".$activityCount;
if($activityCount == 0)
{
$Domain_id = $this->findDomainId($Domain_name);
//debug($Domain_id);
$this->Activity->create('Activity');
$this->request->data['name'] = $Activity_name;
$this->request->data['domain_id'] = $Domain_id['Domain']['id'];
$this->request->data['description'] = $Activity_description;
$this->request->data['inactive'] = 0;
$this->request->data['new'] = 1;
$this->request->data['xp'] = 100;
$Activity_date = PHPExcel_Style_NumberFormat::toFormattedString($Activity_date, 'YYYY-MM-DD h:mm:ss');
$this->request->data['created'] = $Activity_date;
$this->request->data['reported'] = 0;
$this->request->data['player_id_owner'] = $player_id_owner['Player']['id'];
$this->request->data['acceptance_votes'] = 1;
$this->request->data['rejection_votes'] = 1;
if ($this->Activity->save($this->request->data))
{
$this->flashSuccess(__('Activity saved successfully!'. $Activity_name));
echo ("Activity saved successfully!". $Activity_name);
}
else
{
$this->flashError(__('Error while trying to save activity.'));
debug($this->Activity->validationErrors);
}
}
}
I have this function that reads and save domain, activity and player from an excel file. when the excel file contains only 1 row, it functions well, but if the excel contains more than 1 file, only the last row are save but all the activities from all rows are saved, i tried to debug it, i echo every loop and it reads all the row and i try to insert an echo after the saving method to know if it success and it works but when i check it in database, only the last line are saved but the activities are all saved. Kindly help me on this thanks.

Reset the model with $this->Activity->clear();
As the CakePHP book states:
When calling save in a loop, don’t forget to call clear().
The clear method resets the model before saving the data. If you do not use clear(), the ID of the saved row is still in the model, thus the next call to save overwrites the previously saved row.
See the CakePHP book on the clear method:
This method can be used to reset model state and clear out any unsaved data and validation errors.

Related

phpexcel to html only a portion

I'm working on phpexcel. The File I'm working on is from tally export file. I have to read this file and save the data to each user .
For example from this file I need only A2:G10 as HTML/TABLE. So i can display to the particular member (Adv. Chandra Mogan) individually.
I NEED A TABLE FOR ONLY A PORTION OF THE SHEET
What I have done so far:
protected function doExcelUpdate() {
$inputFileName = $this->getParameter('temp_directory') . '/file.xls';
if (!file_exists($inputFileName)) {
$this->addFlash('sonata_flash_error', 'File: not found in temp directory');
return;
}
$this->addFlash('sonata_flash_info', 'File: exist');
try {
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
} catch (Exception $e) {
$this->addFlash('sonata_flash_error', 'Error in PHPExcel');
return;
}
$sheet = $objPHPExcel->getSheet(0);
if (!$sheet) {
$this->addFlash('sonata_flash_error', 'Error in reading sheet');
return;
}
$objPHPExcel->getSheet(0)
->getStyle('A1:G10')
->getProtection()
->setLocked(
PHPExcel_Style_Protection::PROTECTION_PROTECTED
);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter->setSheetIndex(0);
$objWriter->save($this->getParameter('temp_directory') . '/output.html');
}
A1:G10 is not locked. Entire sheet is printed.
First point: "Locking" doesn't change the sheet size, or set a "view window"; it protects parts of the sheet from being edited.
Second point: "Locking" is a feature of Excel, and supported for excel writers, but not for HTML.
Third point: there is no direct mechanism to write only part of a worksheet.
As a suggestion, you might create a new blank worksheet, and then copy the data/style information from the cell range that you want in your your main worksheet to that new worksheet starting from cell A1; then send that worksheet to the HTML Writer.
You can't achive this using locked or hidden cells when you use HTML writer.
You can use a workaround creating a new worksheet and after adding the portion you want to display.
For mantain style on new worksheet (like font, color, border) you must extract it for each cell from the orginal worksheet and apply to the copied cells.
The same thing is for merged cells in the old worksheet.
Your function doExcelUpdate() should be like this:
protected function doExcelUpdate()
{
$inputFileName = $this->getParameter('temp_directory').'/file.xls';
if (!file_exists($inputFileName)) {
$this->addFlash('sonata_flash_error', 'File: not found in temp directory');
return;
}
$this->addFlash('sonata_flash_info', 'File: exist');
try {
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$originalPHPExcel = $objReader->load($inputFileName);
} catch (Exception $e) {
$this->addFlash('sonata_flash_error', 'Error in PHPExcel');
return;
}
$originalSheet = $originalPHPExcel->getSheet(0);
if (!$sheet) {
$this->addFlash('sonata_flash_error', 'Error in reading sheet');
return;
}
// Get the data of portion you want to output
$data = $originalSheet->rangeToArray('A1:G11');
$newPHPExcel = new PHPExcel;
$newPHPExcel->setActiveSheetIndex(0);
$newSheet = $newPHPExcel->getActiveSheet();
$newSheet->fromArray($data);
// Duplicate style for each cell from original sheet to the new sheet
for ($i = 1; $i < 11; $i++) {
for ($j = 0; $j <= 6; $j++) {
$style = $originalSheet->getStyleByColumnAndRow($j, $i);
$newSheet->duplicateStyle($style, PHPExcel_Cell::stringFromColumnIndex($j).(string)$i);
}
}
// Merge the same cells that are merged in the original sheet
foreach ($originalSheet->getMergeCells() as $cells) {
$inRange = false;
foreach (explode(':', $cells) as $cell) {
$inRange = $originalSheet->getCell($cell)->isInRange('A1:G11');
}
// Merge only if in range of the portion of file you want to output
if ($inRange) {
$newSheet->mergeCells($cells);
}
}
$objWriter = PHPExcel_IOFactory::createWriter($newPHPExcel, 'HTML');
$objWriter->save($this->getParameter('temp_directory').'/output.html');
}
UP TO NOW FOR THE WORK TO BE COMPLETED, I HAVE DONE THIS,
private function doExcelUpdate() {
$inputFileName = $this->getParameter('temp_directory') . '/file.xls';
$synopsis = PHPExcel_IOFactory::load($inputFileName)->getSheet(0);
$column = $synopsis->getHighestColumn();
$row = $synopsis->getHighestRow();
$this->cleanUserPayment();
$this->doExcelUpdateTable($synopsis, $column, $row);
$this->deleteExcelFile();
}
private function cleanUserPayment() {
$em = $this->getDoctrine()->getManager();
$classMetaData = $em->getClassMetadata('AppBundle\Entity\UserPayment');
$connection = $em->getConnection();
$dbPlatform = $connection->getDatabasePlatform();
$connection->beginTransaction();
try {
$connection->query('SET FOREIGN_KEY_CHECKS=0');
$q = $dbPlatform->getTruncateTableSql($classMetaData->getTableName());
$connection->executeUpdate($q);
$connection->query('SET FOREIGN_KEY_CHECKS=1');
$connection->commit();
} catch (\Exception $e) {
$connection->rollback();
}
}
private function doExcelUpdateTable($synopsis, $column, $row) {
set_time_limit(300);
$t = [];
for ($r = 1; $r <= $row; $r++) {
for ($c = "A"; $c <= $column; $c++) {
$cell = $synopsis->getCell($c . $r)->getFormattedValue();
if ($cell == 'Ledger:') {
$t[] = $r;
}
}
}
$t[] = $row+1;
$numItems = count($t);
$i = 0;
$em = $this->getDoctrine()->getManager();
foreach ($t as $key => $value) {
if (++$i != $numItems) {
$up = new UserPayment();
$up->setName($synopsis->getCell('B' . $value)->getFormattedValue());
$up->setMessage($this->doExcelUpdateTableCreate($synopsis, $column, $value, $t[$key + 1]));
$em->persist($up);
// $this->addFlash('sonata_flash_error', 'Output: ' . $synopsis->getCell('B' . $value)->getFormattedValue() . $this->doExcelUpdateTableCreate($synopsis, $column, $value, $t[$key + 1]));
}
}
$em->flush();
$this->addFlash('sonata_flash_success', "Successfully updated user bills. Total data updated::" . count($t));
}
private function doExcelUpdateTableCreate($synopsis, $column, $rowS, $rowE) {
$mr = NULL;
$x = 0;
$alphas = range('A', $column);
$oneTable = '<table border="1">';
for ($r = $rowS; $r < $rowE; $r++) {
$oneTable .= "<tr>";
for ($c = "A"; $c <= $column; $c++) {
if ($x > 0) {
$x--;
continue;
}
$mr = NULL;
$x = 0;
$cell = $synopsis->getCell($c . $r);
$cellVal = $cell->getFormattedValue();
if ($cellVal == NULL) {
$cellVal = " ";
}
$cellRange = $cell->getMergeRange();
if ($cellRange) {
$mr = substr($cellRange, strpos($cellRange, ":") + 1, 1);
$upto = array_search($mr, $alphas);
$x = ($upto - array_search($c, $alphas));
$oneTable .= "<td colspan=" . ($x + 1) . " style='text-align:right;'>" . $cellVal . "</td>";
} else {
$oneTable .= "<td>" . $cellVal . "</td>";
}
}
$oneTable .= "</tr>";
}
$oneTable .= "</table>";
return $oneTable;
}
private function deleteExcelFile() {
$filesystem = new \Symfony\Component\Filesystem\Filesystem();
$filesystem->remove($this->getParameter('temp_directory') . '/file.xls');
}

Using array_map when importing data from xlsx

I am importing some data into a mysql table from an xls file.
On the data, i want to use the mysqli_real_escape_string function, before i insert it into the sql table.
My question is that: where should i put the array_map with the escape function in this code below?
Thanks for help.
if(isset($_POST['submitButton']))
{
if($_FILES['file']['size'] != 0 )
{
if($_FILES["file"]["size"] > 5242880 ) { $error[] = "A fájl mérete maximum 5 MB lehet."; }
$filename = $_FILES['file']['name'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if(!array_key_exists($ext, $fajl_types)) { $error[] = "Nem engedélyezett fájl típus."; }
if(count($error) == 0 )
{
$path = "../imports/" . date( "Y-m-d" ) . '-' . rand(1, 9999) . '-' . $_FILES['file']['name'];
if(move_uploaded_file($_FILES['file']['tmp_name'], $path ))
{
$file_name = basename($path);
$objPHPExcel = PHPExcel_IOFactory::load('../imports/'.$file_name);
$dataArr = array();
foreach($objPHPExcel->getWorksheetIterator() as $worksheet) {
$worksheetTitle = $worksheet->getTitle();
$highestRow = $worksheet->getHighestRow(); // e.g. 10
$highestColumn = $worksheet->getHighestColumn(); // e.g 'F'
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
for ($row = 1; $row <= $highestRow; ++ $row) {
for ($col = 0; $col < $highestColumnIndex; ++ $col) {
$cell = $worksheet->getCellByColumnAndRow($col, $row);
$val = $cell->getValue();
$dataArr[$row][$col] = $val;
}
}
}
unset($dataArr[1]); // since in our example the first row is the header and not the actual data
$user_pass = "";
$user_reg_date = date("Y-m-d-H:i:s");
$user_last_login = "";
$user_aktivation = "";
$user_vevocsoport = (int)0;
$user_newpass = "";
$user_imported = (int)1;
foreach($dataArr as $val)
{
$sql = "INSERT INTO user
(
user_vnev,
user_knev
)
VALUES
(
'".$val['0']."',
'".$val['1']."'
)";
$import = mysqli_query($kapcs, $sql) or die("IMPORT-ERROR - " . mysqli_error($kapcs));
$ok = 1;
}
}
else
{
$error[] = "A fájl feltöltése nem sikerült.";
}
}
}
else
{
$error[] = "Nem választott ki fájlt.";
}
}
You can add it when building the query. Like this, the escaping and building the query, which are both related to each other, are close to each other in your code.
foreach($dataArr as $val)
{
$escapedVals = array_map(function($value) use ($kapcs) {
return mysqli_real_escape_string($kapcs, $value);
}, array_slice($val, 0, 2));
$sql = 'INSERT INTO user
(
user_vnev,
user_knev
)
VALUES
(
"' . implode ('","', $escapedVals) . '"
)';
$import = mysqli_query($kapcs, $sql) or die("IMPORT-ERROR - " . mysqli_error($kapcs));
$ok = 1;
}

How to access an .xlsb file by php?

I need to access an .xlsb file that does the same function as this code that accesses a .csv file:
<?php
$file1 = __DIR__ . '/download/Trabalhos.csv';
$csv1 = file($file1);
foreach ($csv1 as $row1 => $line1) {
$row1++;
$column1 = str_getcsv($line1, ';');
if ($row1 == 2) {
$column1[6]."<br>";
$valor1 = $column1[6];
}
}
$file2 = __DIR__ . '/download/produtividade do trabalho.csv';
$csv2 = file($file2);
foreach ($csv2 as $row2 => $line2) {
$row2++;
$column2 = str_getcsv($line2, ';');
if ($row2 == 3) {
$column2[9]."<br>";
$valor2 = $column2[9];
}
}
$file3 = __DIR__ . '/download/inatividade do trabalho.csv';
$csv3 = file($file3);
foreach ($csv3 as $row3 => $line3) {
$row3++;
$column3 = str_getcsv($line3, ';');
if ($row3 == 2) {
$column3[0]."<br>";
$valor3 = $column3[0];
}
}
$total = $valor1 * $valor2 * $valor3;
?>
Access the .xlsb file, scroll through the columns and rows, and display the row value on the screen.
Example: "Line 2, Column G(In this case, G = 6)
"A = 0
B = 1
C = 2)"
...
I want it to show me the value of row 2 that is in column G(6).
As in the first if ...
if ($row1 == 2) {
$column1[6]."<br>";
$valor1 = $column1[6];
}
You can use the PHP Excel library from EasyXLS.
$xls = new COM("EasyXLS.ExcelDocument");
$rows = $xls->easy_ReadXLSBActiveSheet_AsList("Trabalhos.xlsb");
for ($row1=0; $row1<$rows->size(); $row1++)
{
$rowLine = $rows->elementAt($row1);
if ($row1 == 2) {
$column1[6]."<br>";
$valor1 = $row->elementAt(6);
}
}
You can find some more code samples about importing data from xlsb file.
For your purpose you can use PHPOffice/PHPExcel

In phalcon php how to save multiple record in database table

I have following code
foreach ($cartList as $domainDetail) {
$values = array();
$values['customerId'] = $user['userId'];
$values['domainName'] = $domainDetail['domain'];
$values['price'] = $domainDetail['amount'];
$values['status'] = 'active';
$values['creationDate'] = date('Y-m-d');
//create object of Domain
$domain = new Domain();
for($index = 0; $index < count($years); $index++) {
$year = $years[$index];
$values['expiryDate'] = date('Y-m-d', strtotime('+' . $year. 'year'));
//save domain data to the database
$domain->save($values);
}
$domainId = $domain->getDomainId();
if (empty($domainIds)) {
$domainIds = $domainId;
} else {
$domainIds = $domainIds . ',' . $domainId;
}
if ($domainNames != '') {
$domainNames = $domainNames . ',' . $values['domainName'];
} else {
$domainNames = $values['domainName'];
}
}
When I execute this code in my table the entry for expiry date field i for every save up to for loop execute will bt the last expiry date only.
This skip first expiry date

List images from directory by function

I'm using this function:
function getmyimages($qid){
$imgdir = 'modules/Projects/uploaded_project_images/'. $qid .''; // the directory, where your images are stored
$allowed_types = array('png','jpg','jpeg','gif'); // list of filetypes you want to show
$dimg = opendir($imgdir);
while($imgfile = readdir($dimg))
{
if(in_array(strtolower(substr($imgfile,-3)),$allowed_types))
{
$a_img[] = $imgfile;
sort($a_img);
reset ($a_img);
}
}
$totimg = count($a_img); // total image number
for($x=0; $x < $totimg; $x++)
{
$size = getimagesize($imgdir.'/'.$a_img[$x]);
// do whatever
$halfwidth = ceil($size[0]/2);
$halfheight = ceil($size[1]/2);
$mytest = 'name: '.$a_img[$x].' width: '.$size[0].' height: '.$size[1].'<br />'. $a_img[$x]. '';
}
return $mytest;
}
And I call this function between a while row as:
$sql_select = $db->sql_query('SELECT * from '.$prefix.'_projects WHERE topic=\''.$cid.'\'');
OpenTable();
while ($row2 = $db->sql_fetchrow($sql_select)){
$qid = $row2['qid'];
$project_query = $db->sql_query('SELECT p.uid, p.uname, p.subject, p.story, p.storyext, p.date, p.topic, p.pdate, p.materials, p.bidoptions, p.projectduration, pd.id_duration, pm.material_id, pbo.bidid, pc.cid FROM ' . $prefix . '_projects p, ' . $prefix . '_projects_duration pd, ' . $prefix . '_project_materials pm, ' . $prefix . '_project_bid_options pbo, ' . $prefix . '_project_categories pc WHERE p.topic=\''.$cid.'\' and p.qid=\''.$qid.'\' and p.bidoptions=pbo.bidid and p.materials=pm.material_id and p.projectduration=pd.id_duration');
while ($project_row = $db->sql_fetchrow($project_query)) {
//$qid = $project_row['qid'];
$uid = $project_row['uid'];
$uname = $project_row['uname'];
$subject = $project_row['subject'];
$story = $project_row['story'];
$storyext = $project_row['storyext'];
$date = $project_row['date'];
$topic = $project_row['topic'];
$pdate = $project_row['pdate'];
$materials = $project_row['materials'];
$bidoptions = $project_row['bidoptions'];
$projectduration = $project_row['projectduration'];
//Get the topic name
$topic_query = $db->sql_query('SELECT cid,title from '.$prefix.'_project_categories WHERE cid =\''.$cid.'\'');
while ($topic_row = $db->sql_fetchrow($topic_query)) {
$topic_id = $topic_row['cid'];
$topic_title = $topic_row['title'];
}
//Get the material text
$material_query = $db->sql_query('SELECT material_id,material_name from '.$prefix.'_project_materials WHERE material_id =\''.$materials.'\'');
while ($material_row = $db->sql_fetchrow($material_query)) {
$material_id = $material_row['material_id'];
$material_name = $material_row['material_name'];
}
//Get the bid methode
$bid_query = $db->sql_query('SELECT bidid,bidname from '.$prefix.'_project_bid_options WHERE bidid =\''.$bidoptions.'\'');
while ($bid_row = $db->sql_fetchrow($bid_query)) {
$bidid = $bid_row['bidid'];
$bidname = $bid_row['bidname'];
}
//Get the project duration
$duration_query = $db->sql_query('SELECT id_duration,duration_value,duration_alias from '.$prefix.'_projects_duration WHERE id_duration =\''.$projectduration.'\'');
while ($duration_row = $db->sql_fetchrow($duration_query)) {
$id_duration = $duration_row['id_duration'];
$duration_value = $duration_row['duration_value'];
$duration_alias = $duration_row['duration_alias'];
}
}
echo '<br/><b>id</b>--->' .$qid. '<br/><b>uid</b>--->' .$uid. '<br/><b>username</b>--->' .$uname. '<br/><b>subject</b>--->'.$subject. '<br/><b>story1</b>--->'.$story. '<br/><b>story2</b>--->'.$storyext. '<br/><b>postdate</b>--->'.$date. '<br/><b>categorie</b>--->'.$topic_title . '<br/><b>project start</b>--->'.$pdate. '<br/><b>materials</b>--->'.$material_name. '<br/><b>bid methode</b>--->'.$bidname. '<br/><b>project duration</b>--->'.$duration_alias.'<br /><br /><br/><b>image url</b>--->'.getmyimages($qid).'<br /><br />';
}
CloseTable();
The result outputs only the "last" file from the directories.
If I do an echo instead of a return $mytest;, it reads the whole directory but ruins the output.
You are always overwriting $mytest in your loop:
for($x=0; $x < $totimg; $x++)
{
$size = getimagesize($imgdir.'/'.$a_img[$x]);
// do whatever
$halfwidth = ceil($size[0]/2);
$halfheight = ceil($size[1]/2);
$mytest = 'name: '.$a_img[$x].' width: '.$size[0].' height: '.$size[1].'<br />'. $a_img[$x]. '';
}
return $mytest;
So after the loop, $mytest contains the last value that was generated in the loop. You might want to return an array instead:
$mytest = array();
for($x=0; $x < $totimg; $x++)
{
$size = getimagesize($imgdir.'/'.$a_img[$x]);
// do whatever
$halfwidth = ceil($size[0]/2);
$halfheight = ceil($size[1]/2);
$mytest[] = 'name: '.$a_img[$x].' width: '.$size[0].' height: '.$size[1].'<br />'. $a_img[$x]. '';
}
return $mytest;
But of course you also have to change your other function in order to deal with the returned array.

Categories