Jump to content

Read image and data from csv file.


roldahayes

Recommended Posts

Hi please have a look at the code here.

 

I have a csv that has only 2 colums, image url and then a line of text.

 

I'm trying to get the page to read that file but not having much luck!!

 

<?php



$quote = file('./files.csv');



foreach($quote as $i => $quote_info)
{
    list($image) = explode(',', $product_info);
        list($w, $h) = getimagesize($image);
     
}

?>

Link to comment
https://forums.phpfreaks.com/topic/76747-read-image-and-data-from-csv-file/
Share on other sites

yeah sorry,

 

I the CSV contains a list of famous quotes, and i just want them listed on a page, but next to them at the start i want a "bullet" image to make the page look better so the first colum of the file has ./images/comment.gif then has the quote.

 

heres the page

 

http://www.gkmedia.co.uk/greatoneliners/test.php

 

Hope this makes sense!

Ok, it nearly works now!

 

image isn't loading though eben with the direct url as the img scr=

 

http://www.gkmedia.co.uk/greatoneliners/test.php

 

the code i was using earlier is

 

<?PHP

$file_handle = fopen("./files/sport.txt", "rb");

while (!feof($file_handle) ) {

$line_of_text = fgets($file_handle);
$parts = explode('=', $line_of_text);

print $parts[0] . $parts[1]. "<BR>";
}

fclose($file_handle);

?>

 

can the bullet be added to this as i would prefur using this??

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.