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
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!

Link to comment
Share on other sites

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??

Link to comment
Share on other sites

<?php

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

while (!feof($file_handle) ) {

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

print '<img scr="images/bullet.png />' . $parts[0] . $parts[1]. "<BR>";
}

fclose($file_handle);

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.