Monday, 24 November 2014

Set Image on ImageView from pc to Android



I'm working in an application that shows some user data and I want to show the image of the user,the problem is that the images are stored in a folder on my computer and in the MySQL database I only store de path of each image. How can I send the image files via PHP/XML and catch them in Android?


I was thinking in store the paths in an array like this:



<?php
require_once('databaseconnection.php');

$img=array();

$sql=mysqli_query($CON,"SELECT RutaImagen FROM terminales");
while($row=mysqli_fetch_assoc($sql)){
$img[]="".getcwd()."\\imgterminales".$row['RutaImagen']."";
}

print_r($img);

mysqli_close($CON);
?>


This works well and this is the result:


Array ( [0] => C:\xampp\htdocs\fisgon\imgterminales/kaba.jpg [1] => C:\xampp\htdocs\fisgon\imgterminales/pelonchas.png [2] => C:\xampp\htdocs\fisgon\imgterminales/finanzas1.jpg [3] => C:\xampp\htdocs\fisgon\imgterminales/finanzas2.jpg [4] => C:\xampp\htdocs\fisgon\imgterminales/vader.jpg [5] => C:\xampp\htdocs\fisgon\imgterminales/gandalf.jpg [6] => C:\xampp\htdocs\fisgon\imgterminales/default.jpg )


Hope you can help me. Thanks


No comments:

Post a Comment