Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Generate Dynamic Images Alongwith Other Html Data.


I have a set of images on a server. I want to pick these from the
database without creating a

temporary file on the server; and also have some text alongwith it.

Something like,

ImageViewer.php
<?
print ( "<IMG SRC='GetImage.php?strImageId=1'>" );
print ( " some description about the image... " );
print ( "<IMG SRC='GetImage.php?strImageId=2'>" );
print ( " some description about the image... " );
....
....
?>
GetImage.php would server me with the image data from the database,
probably something like this.
<?
.... Create database connection ...
.... Get image data from database depending on strImageId ...

header ( "Content-Type: Image/gif" );
print ( $image_data );
?>




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Using NetPBM To Generate Thumbnail Images.
I need to be able to accept a gif/jpeg image upload and then:

1.) Save it into a database.
2.) Create a thumbnail of the uploaded image and save it to a database.

I am able to upload an image directly into a database, but I'm having trouble trying to generate a thumbnail of the image. It just shows up as a broken image.

Here is my test code that I'm using to try to develop this feature. You pass the id# of the image in the database and it should retrieve the image, make a thumbnail of it, and then display the thumbnail. All I get is a broken link though. Can somebody point out my mistakes? Code:

Script To Generate Auth Images For Comment Posting?
you probably know the comment SPAM problem. If you have a homepage and want to
allow your users to post a comment you will end up getting a lot of SPAM posts
from robots.

I was thinking that there might be some free/opensource plugin available to
create such images with numbers on it. I don't want to reinvent the wheel. Can
anyone point me to something like that or tell me the correct keywords for
searching for it by myself?

Typo3: Generate Dynamic Website, Show Only The Pages That Include Content
i want to create a web form where someone can do some input or pick
strings from select boxes. after that the person can click a preview
button and a website will be generated dynamically. so i thought i
should use typo3. first of all i created a html-template. then a page
tree with all the sites that could possibly appear. in the end only the
sites with content, will be shown. all of this must happen
automatically. so i need a php script or a typoscript that compares the
"pages" table with the "tt_content" table. after that the attribute
"hidden" in the "pages" table should be "true" for the pages that
doesn't contain any content.

does anyone have an idea if this is possible or if typo3 is the right
choice?

Generate HTML From PHP
I am just wondering if it is possible to save a HTML string from PHPs?
Let me elaborate more on what I mean.

If you do
<?php
include 'abc.php'
?>

//abc.php
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
echo "Hi, I'm a PHP script!";
?>
</body>
</html>
<?php $a_number = 5?>
<javascript ...
<?php echo $a_number ?>
/javascript>

I am looking for a way to display only HTML and javascript and have
$a_number replaced with 5.

I need something that will display resulting HTML of PHP execution. So
if there are functions or database queries in PHP, the HTML string
will reflect the result of function execution or retrieved result from
database queries. Not the function definition or database query
strings.

In other words, process a seperate PHP file and return its HTML output
like the INCLUDE function, but do not output it (instead set it to a
variable value).

Generate PDF File From HTML Using PHP
anyone know how to generate pdf file using php.. As far as i know there are 2 ways to do that.

1) Using PDF library
2) Using header that will send application type as pdf

Anybody know which is the better or easiest way to generate pdf?

Generate PDF File From HTML?
I have a html file. How to generate PDF file using PHP?

Php Generate HTML, But Being Called By Javascript
I've been searching for few days trying to find an answer to my
question... hopefully I ofund the right place to help me out!

What I am trying to do is use javescript inside column of a <table>
tag, to call a php file that will fill in the contents for my column
and the html page will then finish loading... For example:

<html>
<tr>
<td valign="top">
<script type="text/javascript"
src="dir/external.php?"></script>
<script language="" type="text/javascript">
<!--
for (x = 0; x < 10; x++)
{
document.writeln("<a href=data returned from php call >

</a>");
}
//-->
</script>
</td>
</tr>
</html>

To give you all a background of what I am doing is, I am using
MagpieRSS to parse out my XML file and I would like to have my php file

generate an array of data from the parsed file to return back to the
javascript in my HTML file and use it to fill in my column... make
sense?

Php Generate HTML, But Being Called By Javascript
I've been searching for few days trying to find an answer to my
question... hopefully I ofund the right place to help me out!

What I am trying to do is use javescript inside column of a <table>
tag, to call a php file that will fill in the contents for my column
and the html page will then finish loading... For example:

<html>
<tr>
<td valign="top">
<script type="text/javascript"
src="dir/external.php?"></script>
<script language="" type="text/javascript">
<!--
for (x = 0; x < 10; x++)
{
document.writeln("<a href=data returned from php call >
</a>");
}
//-->
</script>
</td>
</tr>
</html>

To give you all a background of what I am doing is, I am using
MagpieRSS to parse out my XML file and I would like to have my php file
generate an array of data from the parsed file to return back to the
javascript in my HTML file and use it to fill in my column... make
sense?

Generate A Html Version Of A Pdf File
Basically what I am trying to acheive is that, we are using pdftohtml version 0.34 on our site, and I want to be able to generate a html version of a pdf file on the fly, so that the search engines can atleast index something about it, when they spider the site.

I have been playing around using exec and shell_exec and system but none of them are working for me. The code I currently have is:- PHP Code:

Use Of PHP To Generate (X)HTML Compliant Forms From XForms
I've been struggling for a long time with HTML_Quickform from PEAR. The
concept is ideal, but, the implementation is (IMHO) a bit of a kludge.

As a developer I want a quick and easy way to generate/validate/process
forms without hand hacking HTML, however, I also want it to be easy to
do! The HTML_Quickform method seems to require more work than it should
and whenever you start getting really complicated forms, the hassle
starts to outweigh the benefits.

I know XForm is currently lacking client-side support, but, with the
implemtation of decent XML parsing functions on PHP5 I'm suprised by
the lack of uptake in this area. XForm would be an ideal way of
managing the process, extremely lightweight XML that can be processed
on the server-side and sent as standard HTML to the client. Once the
client-side support picks up then you can just present the original XML
and no-need to re-code your app.

Are there some projects that perhaps I haven't found? I noticed they're
working on HTML_Quickform2 to make up PHP5 compatibility, surely a
better solution would be to push forward with Xforms? Or is it more
policital, I know XForms have been around a while, is there something
stopping them getting the support they need.

Generate An Html Form, To Be Submitted For Insertion To A 3rd Table
1. display a form consisting of radio buttons and check boxes. multiple selection of check boxes per radio button basically.

I got this part done, it displays the data in the form which is being pulled from two separate tables.

2. Insert for each check box a record into a third table of the check box and radio button.

this is what i have thus far and I'm not really sure why it's not working from what i can see step by step it should be inserting the records, these arrays are the most terrible thing i can think of having to do. Code:

Forward To Page Alongwith Variables In POST
How to forward a page to another page alongwith the parameters passed into it

I mean I have page a.php
which is called with some parameters in $_POST and I require to pass these to another page with same variables in $_POST

Dynamic Images
I just wrote some functions last night for a few people, I posted them
up for whom ever wants it (free)

It is simple a way to spit out thumbs, or resized images, and to cache the
image so it doesnt have to be rebuilt.

Nothing fancy, but it could help a few people out.

Dynamic Images
I am trying to make a script that writes text onto a small image. How would
I make the image expand (wider) if longer text is inputed?

Dynamic Images
I'm currently making a site for a game/mod, which enables multiplayer. A person can set up their server so it posts information to my site and it's stored to a database. Anyway, I want to make it so my users can have a dynamic picture to use as a signature on forums. However, as it currently is, it won't display because it's in the format of "http://mysite.com/banners.php?name=their-name-here"

I know it's possible to have the image saved, but I want it as a status checker of the server, so I need the image updated whenever it's accessed. Is there any way to do this with php and .htaccess scripts? Preferably in the form of http://mysite.com/banners/their-name-here.png

Dynamic Images
how do you make dynamic images, that show statistics. I have an online game, and i want to make a dynamic image to show the people logged on. I can handel that, but i need to know how to make a dynamic image.

Caching PHP GD Dynamic Images
I have a PHP script that takes a handful of parameters and outputs a graphic based on those parameters. The file name is a direct representation of the input parameters. For example (widgetized):

image.php?a=red&b=big&c=png outputs the file red.big.png to the web accessible directory /output/

I've actually already picked a way of caching the output of this script but would like to discuss possible alternatives and get a feel for "best practices" in this area. Here are the two general methods of caching I had originally considered:

Method A) The PHP script is called through an <img /> tag and first uses the file_exists() function to see if the image has already been made. If it does exist, the PHP script uses the header() function and the readfile() function to output that existing image. Or if it does not exist, it generates the image, writes it to the static position then uses header() and readfile() to output the image.

Method B) The images are called using the static path in an <img /> tag. The directory /output/ uses a custom 404 error page (image.php) which parses out the $_SERVER['REQUEST_URI'] with the explode() function to populate the input parameters and generate the image. It puts the image in the static folder, then uses header() and readfile() to output the image to the server.

1. What are the pro's and cons to these two different methods of caching the images?

2. Is there any reason why either method *can't* be used?

3. What other methods are there? Or, how would you improve on these methods?

I'd appreciate your input on this subject, or if you can recommend other Apache directives/PHP functions that would be useful in this scenario.

Dynamic Images And Headers
So i'm building an OO based media management system for my website and i'm having trouble with the following... example url: /media/image/3252/

My mediaHandler can recognize what type of file needs, via the URL, to be downloaded or send, such as an image object for example, or a .zip file. The ID is sent read from the URL as well so it knows where to look in the DB.

The mediaHandler then grabs the file and returns and appropriate fileObject. It also checks the referrer (to eliminate leechers) and updates the download count / hit count in the db. In the example URL i'm trying to get an image, so an imageObject would be returned.

The image Object has a filepath, filename, width and height, among other things. My mediaHandler also can take a width or a height as an argument and, using the gd library, create a resize & logo branded output image.

An image object (which is a child of a file object), has the contents of the file as one of its properties**. If an image is not to be resized, the handler is supposed to just pass the image (i think via headers) to the browser. // This is where i need help, i can't figure this out....

If theres a manipulation to be made, the image needs to be manipulated, cached and stored cache in the db, and then sent to the output to the browser. I would like to know if there is a way to "pass the file" through my media handler without using GD to create a blank image and using up more memory it should be.

Dynamic Images/ PHP Write To Image
Ive got a project where i need to have a form that someone can fill out, choose a font from the drop down list, and then hit submit. This then takes you to a new page where you choose the image background. once you chose the image backgorund it then makes that image with the text ontop of it.

Make Dynamic Shadows On Images!?
When I use the GD library on php I can't seem to find a way to generate
dynamic shadows on my images? Do I have to draw it my self or is there a
way?

Finding Images In HTML
I am a bit stuck. I need to read the contents of a form submission - namely a block of HTML and single out all of the image sources eg: Code:

Using PHP + Images In An Html TextArea Tag
I'm trying to add images to a TEXTAREA tag (in my PHP web page) using
the usual image tag:

<INPUT TYPE="image" etc.

But the images are not showing up in the TEXTAREA but rather outside,
below it - I'm trying to display thumbnail images in a scrolling area
on the web page so I can insert a variable number of images into the
TEXTAREA object - can this be done this way or is there a better way
to insert multiple images in a scrolling object for a web page?

Dynamic Data
I have included a php script into my page
as <img src="plot.php">. That script just plot some time changing data. Now I have two questions that I cannot solve myself:

(1) When I press the reload button I expected
the plot reflected the changed data.
Instead of that plot remains unchanged
until I directly invoke the php script
from the browser...
Is there any method to avoid this
unwanted caching?

(2) That is a bit off topic but is there
any easy way to get a web page updating
after a certain period of time?
Once solve my first question I'd like
to offer mi visitors a automatically
changing graphic.

Mail() & HTML Email With Images
I've been busy with sending email by using the PHP mail() command. I tried to send a mail with HTML layout but somehow the images didn't work..

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<?php

$adress = 'mymail@internet.com'
$subject = 'MyMail'
$message = "<body bgcolor=#0088ff><img src="www.mydomain.com/printer.gif"><font face=arial color=white>This is <b>a</b> test</font>";
$extra = "From: "MySelf" me_and_myself@internet.comnReply-to: me_and_myself@internet.com";
//$extra .= "nReturn-Path: <me_and_myself@internet.com>";

$extra .= "nContent-Type: text/html;";

if ( ! mail ($adress,$subject,$message,$extra)) { // [, string additional_headers])
print( "Blieb! Error!" );
}

?>

Can anyone tell me what I'm doing wrong or what I'm forgetting? I know it's possible because I receive a lot of mailings with images in them (is very frustrating)

Embeding Images In HTML (thumbnails)
Hello, I've been working on this for a long time today and I'm not making any progress

I want to have a page that displays a thumbnail located in the database (thumbnail table) and when clicked opens a new page with the image in the original size, which is also located on the DB. The latter part works ok, the former (thumbnails) does not.

This is my code:

PHP-gen'd Images Won't Display In HTML
I have an image-generating script myimage.php that's worked and that I've
used for years. All it does is increment a counter file and output a single
pixel in the color I provide. But on one particular web server I uploaded
to, the behavior is strange.

If I enter the URL http://www.domain.ext/myimage.php, the picture is
displayed as expected. But if I insert the script into HTML, like <img
src="myimage.php">, it fails to display and I get the broken image icon,
instead.

This has never happened before, but I do not know enough about PHP builds
and web server settings to figure this out.....

PHP To Display Images In Html Docs
I am trying to display images in an html page using a
php script. The output on the screen is bizarre:

This code works on its own:
<?
$pic = "flower.jpg"
echo file_get_contents ($pic);
?>

the above actually displays the image flower.jpg
without a problem.

But when I include the same script in an html page
the screen is filled with all sorts of characters

Something like this:
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/jpg;
charset=windows-1252">
</HEAD>
<BODY>
<?
$pic = "flower.jpg"
echo file_get_contents ($pic);
?>
</BODY>
</HTML>

Have tried another charset e.g. "charset=utf-8"
instead of "charset=windows-1252",
but to no avail.

What is the problem? Is there a way of getting the
image to work via php *inside* an html document?

Uploading An Html File With Images
I am trying to upload an html page with images, presently we upload the html file first and then upload the images seperately. The user has to remember the images present in the page and upload them.

Dynamic Page HTML Code Question
I'm gonna have all my pages load up a dynamic header and footer, depending on what variable I call up.

So at the beginning of my code it will call for a banner, this banner will be set as a variable in a seperate page that i'll call up.

Now i'm wondering, can the page I call up (with a list of variables) have HTML code in it, like this:

Update A Ststic HTML Form To Dynamic
I have a form which I now want to be more dynamic. The datbase tables are builtbut I cannot get the fields to populate.

When a member selects an age group from the first select statement and the dates that age group are scheduled to play a match are displayed in a second select statement. When both select ions have been made the rest of the form is displayed and can be filled in and the database updated. Code:

Dynamic Data In Table
Trying to display dynamic data in a table. The code spits out the table just fine, but won't display the $name variable at all, I just get table cells w/ broken links. I must be missing something but can't get it, thanks. my code:

Returning HTML As Word, How Do I Embed Images?
I'm sending html content to the client computer as "application/msword" using the following code (see further down): Is it possible to embed images in $docContent so it will be accessible in the client computer if he:

1. Saves the downloaded doc and.
2. Laiter open the document without being online?

example code:

Store Images In MySQL And Use Them In Html Files
Does anybody know how to store bitmap data (jpg or png files) in a MySQL table and how to call those files in dynamic php3 generated web pages: I'd like to build an articles database with a jpg file for each article. Data (images and articles) are updated by registred users via a form.

I've found many articles and tips explaining the way to store such bitmap data in a MySQL table, but nobody seems to explain how to get the files from the table and put them in a html file………

Saving A Dynamic Php-file As Static Html (on The Server)...
- I have a problem trying to save a dynamic php/mySQL online order form as static html on the server - I'm not really sure this is possible at all - but my problem is that the order-form consists of a lot of items (100+) + the customer data - and we simply don'y have the kind of database capacity to store each order in a database.
As stated earlier I don't know if this is possible? - the static files should also be named after variables so that it would be possible to search a directory on the server for specific orders (that is $blah_$blaah.html) - but that's not a problem - I know how to do that.

Variable Data In Dynamic Table.
What I'm trying to do is list the values of an array into different table rows while alternating the color of the table rows. Simple enough right? It makes the table fine. Creates the proper ammount of rows. It even alternates color (yay!). The only thing that it doesn't do is list the values in the array. PHP Code:

A Link That Updates Dynamic Data
What I'm trying to do is have a webpage that updates the dynamic data from a database based on what links are chosen on the left side of the page.

- On one side of the page is a list of links. (ie: potato, carrot, apple...)

- On the other side of the page is a bunch of dynamic data that connects to a MySQL database.

Depending on what is chosen on the left side of the page, it will show the user that information from the database on the right side. Example:

If you click on the apple link, it pulls the apple row out of the database and presents a picture of an apple, gives some information on an apple, etc.

I don't think this is very hard but I don't see it in any of the books I have, and have never done it before. Can someone help point me in the right direction or tell me how this is done?

Show Images Using Mysql Data.
i have a script that can do ip2country and i need to show the flags on it but i dont know how to call the data from the database and then add the .png image extention on the end of it anyone know?

Updating Images (Binary Data)
I have a page that I use for users on my site to upload an image (displayed on their personal page).

I am trying to figure out how I can update/replace the image in the database so that they can change their image.  Can binary data be updated? Here's the code for my upload script: Code:

Dynamic Insert Of POST Data Into Database
I have two tables one with game data ie visitor team home team so on and so forth and one with team name and team id, this info is pulled into a dynamic form. I can get the data from the form ok

foreach($_POST as $key => $value){
echo "$key:$value";
}

when I echo the info it gives me the correct output

game1:7 game1id:513
game2:14 game2id:514

I have columns in the database that correspond to the form var fields What my question is is how do I get the info into the database through each iteration in one row?

This is an example I have tried and I know doesn't work

$sql = "INSERT INTO teampicks ($key) VALUES('". $value ."')";
$res = mysql_query($sql);

Dynamic Include Page Post Data
I have a index file which carry content as included page. Its take parameters like this (index.php?page=katlist). So I am trying to send data from form inside page as (index.php?page=katlist&searchterm=blabla) but I dindt success.....

Calling Data From MySQL To Echo Images
I've been trying to use data from a database to echo images. I thought that if I used the PHP page to connect to the database I could then do something like the below

if ($user == "user") {echo "<img src="http://www.whatever/images/whatever.gif">"; }

Building Dynamic Report Page On Table Data
I am posting this message to this forum because I need some advice and some help with building a page to produce a report from the database I am building. Firstly, however I will post the table structures for the involved tables..... Code:

Matching External Data With Database For Dynamic Site
I have a  table with 4 columns where I'm showing 900 products, each product in it's own row The first column has the name of the product, that is coming from our database. The next 2 columns are ratings for each product, These ratings are gathered from 2 different external web pages. The reason that this rating are being grabbed from an external page it's because they change and are updated on a daily basis at their respective site.

The last column is a final rating we give to each product based on a calculation of the  2 previous columns. The main idea is that the information updates automatically as the external sites do. The problem is matching the data for each product. Code:

Send Email Include Page With Dynamic Data
I want Users to fill in from. data go's to MySQl send email to user and myself containing "form tekst.

Getting EXIF Data From External Images (http URLs)
exif_read_data() doesn't support URLs
(http://php.net/manual/en/function.exif-read-data.php ) but I would
like to do that with the minimum traffic and overhead possible.

A naive solution would be downloading the whole target file locally and
then call exif_read_data() but that means a lot of overhead traffic
considering I only want the exif header.

My approach would be getting just the header but

1) Did anyone implement it already?

2) Is it possible? Any suggestions/advices about how to acheive it? (I
know some php but I'm far from being an expert)

Formatting Html And Php For Data
I'm having trouble formatting information from a MySQL database using PHP. I'd like to dynamically insert the <title> information, as well as the first name, last name and price range. Here's what I have, but it pulls up the correct information, but it's not within the table and the <title> information pulls up a blank. Code:

Displaying Data In Php - Like HTML?
How do I display data from MYSQL in PHP in an attractive and structured table(HTML) format? For example: I want my database to display all the reviews of a particular movie(like metacritic.com) like this: Code:

Get Data Between HTML Tags
I'm looking to get the baseball score between the html tags on yahoo and
create my own rows with just the data.

So far I have this code
-----------------------------------------------------------
$data = file_get_contents('http://sports.yahoo.com/');
list(, $data_split) = explode('<td width="50%" class="yspscores">', $data,
2);
list($data2, ) = explode('</a></td>', $data_split, 2);
$data2 = strip_tags($data2);
echo $data2;
-------------------------------------------------------

It gives me all the results but I want to do a loop that will find the first
row of scores create a new row and put the data in the new row then find the
next row of scores create another new row and insert the data and continue
that pattern to the end.



Converting Table Data From HTML To PHP
I have a problem converting data from a html file, to a 3 way split. (header.php index.php and footer.php, Reason being PHP won't parse the following line,
<table width="37%" border="0" cellspacing="0" cellpadding="0" height="163">
I think it all revolves around the % sign, does anyone have any ideas about how to fix it without limiting the width to X amount of pixels?


Copyright © 2005-08 www.BigResource.com, All rights reserved