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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Ouput Image


I am trying to output an image with text coming from a database"

$image=mysql_result($result,$i,"image");

trying to output it like this:
<img src=../prod_images/" . $image . " height=90>

problem is that some images have a space in the text like "image 1". When it is outputted onto the screen, the browser does not read anything after the space. How can I get around this?




View Complete Forum Thread with Replies

Related Forum Messages:
Ouput Formatting...
I would like to have the results of my query display in a grid format.  The code below returns my thumbnails and links them to the actual images. However the entries in the database are simply paths to these images. I thought I could do this with CSS but the way this query is returning the results I am stuck and not sure how to resolve it.  Any suggestions?

View Replies !
Select And Ouput
I'm trying to display a bunch of pictures in rows with 5 pictures per row. The filenames of the pictures are all stored in a MySQL database and the actual files are stored on the server. So, I know how to return and output all of the records from a MySQL table using a while statement.

However, I need to only output five of them, insert a break in the HTML to start a new line, and then output five more and another break, and then do it again until there are no more pictures left. Anyone have any ideas?

View Replies !
How To Ouput A Html Page To PDF ?
I been able to output data from MySQL page and put in into a generated HTML page using <TABLE>.

Is there any fastest way to convert the HTML page directly into a PDF document for the user to download when the user click on a link, juts like the one (PDF Version / Printable Version) of Devshed.com?

View Replies !
Mysql/PHP To Excel Ouput?
I can successfully, output contents from two mysql tables into excel but I was wondering if there was a way of determining the actual layout - column sizes because at present they are all over tha place? .....

View Replies !
I'm Getting Strange Ouput In Url String
I've been getting strange output in my url string within my app lately. It adds stuff like ?1174406969965 when I'm not even posting a url string on my forms. This doesn't seem like a big issue, but I was wondering if anyone has ran into this before. Code:

View Replies !
HTML Ouput Gets Scrambled While Parsing
On a page I want to display rows of recordset, coming from a mysql database. The problem is that somewhere halfway, PHP seems to generate messed up HTML code for no reason at all.
e.g:
The first 54 records display correct syntax. Code bellow is an examlpe of a row ouput for record 54 Code:


View Replies !
Sorting LDAP Ouput With PHP3
I am wanting to create a telephone list of all users on a LDAP database. I have managed to extract the data, but cannot get the code to sort the results in alphabetic order , based on surname. My code:

View Replies !
How To Ouput PDF Directly To The Browser From PHP Script
I know how to ouput PDF directly to the browser from PHP script, but is there any way to
create a PDF file to the server harddisk from PHP?

View Replies !
No Ouput After ADODB Connection Attempt?
I am trying to connect to a MSSQL Database but I am having some problems. I create this function in a file (Called functions.php) Code:

View Replies !
How Do I Get The Image Height Width When Generating Image From PHP (getimagesize Does Seem To Work)
Is it possible to obtain the width/ height of an image when that image
is dyanically created using a PHP script and passing GET attributes.
For example:

<img src="images/showImage.php?image_id=5" />

My images are created from images stored on the server, their paths
stored on in database table and retrieved using the GET image_id and
PHP script (showImage.php). Because the images are different sizes I
would like to be able to use a PHP function / class that can take an
image path and generate the IMG width and height attributes. This
would just tidy up the page when loading.

So when I try to use PHP 'getimagesize' like so:

$wh = getimagesize ($_SERVER['DOCUMENT_ROOT'] . "/images/showImage.php?
image_id=5");

.... I get an error saying that the file or directory does not exist:

Warning: getimagesize(/customersites/0/home/httpd/vhosts/
mydomain.co.uk/httpdocs/images/showImage.php?image_id=5): failed to
open stream: No such file or directory in /customersites/0/home/httpd/
vhosts/mydomain.co.uk/httpdocs/classes/html.class.php on line 11

I thin it may be the GET atttribute that is throwing it. How would I
go about doing this?

View Replies !
Determine Image Information On Image Stored In MySQL BLOB
I store images in my DB as BLOB. When I want to place them in an html
table, I want to determine the width of the image in order to asign the
correct width to the column inside table.
For JPEGs this is working fine, this is my code:

$image = @imagecreatefromstring($r["foto"]);
return @imagesx($image);

where $r["foto"] is the field selected from the db which contains the image.

For GIFs however, its getting really on my nerves !!
I know imagecreatefromstring is not supported in gd2 and I tried several
thinks. None of them worked ! :
-
$temp = tmpfile();
list($width, $height, $type, $attr) = getimagesize($temp);
echo $attr;

gives me :Warning: getimagesize: Unable to open 'Resource id #6' for reading
-
$handle = fopen("/tmp/tmp.dat", "w+");
fwrite($handle, $r["foto"]);
list($width, $height, $type, $attr) = getimagesize($handle);
echo $attr;

gives me : Warning: getimagesize: Unable to open 'Resource id #6' for
reading
-
Doing this with imagecreatefromgif($temp); wont work either !

Can somebody help me out please? by telling me what I'm doing wrong or what
I should do.

View Replies !
Script To Post A Placeholder Image If Image Is Not Found On Server
I'm creating a site with an archive of photo galleries, and on each gallery page i'm looking to have a sidebar that shows a cross-section of other galleries in groups of 10, via thumbnails... except that sometimes, the updated galleries won't actually be there yet, so i'd like to have a script that basically looks for "set053/001.jpg", and if that image hasn't been uploaded, then a placeholder image saying "coming soon" would be shown. Ugh, that's a horrible descrition. Here's the outline of it:

-Say there are 52 photo sets (updates will be made regularly).
-If you're on any gallery between 1 and 10, this "sidebar" will show thumbnails of the other galleries within that group of 10.
-On a gallery between 11-20, you'll see the sidebar thumbnails for galleries 11-20... and so forth.
-But on the most recent set of 10, in this instance galleries 51-60, the galleries 53 thru 60 haven't yet been uploaded, so having a static sidebar that shows "galleries 51-60" would yeild broken images for the thumbs for 53 - 60 right now.

So hopefully that made more sense... basically, if PHP can find "set053/001.jpg" on the server, it shows it. If it can't, then have it show something like "images/comingsoon.jpg".

View Replies !
Make Like An Image With A Preset Image In Backround And Some Text In Forground.
I have been reading this book and its been trying to explain the uses of the gd library. now i understand you can create images to be output. now how do i go and make like an image with a preset image in backround and some text in forground.

View Replies !
Writing A Blob Image Out To A File - Jpg Image Looks Weird?
I've got simple watermarking working. I write a Blob image out from my db to a temp file and then overlay the watermark image to create 1 whole image.

The watermark is perfect, but the exported blob behind it looks all garbled - parts are visible but its not right!

I've looked at the temp file thats created by the line "fwrite($t_img, $data);" and the image looks corrupt, but displaying this field using usual php methods the blob looks fine.....

Here's the code :-

@MYSQL_CONNECT("$server","$user","$password");
@mysql_select_db("$database");
$query = "SELECT image, mime_type, image_width, image_height FROM items WHERE ID='$id'";
$result = @MYSQL_QUERY($query);
$data = @MYSQL_RESULT($result,0,"image");
$type = @MYSQL_RESULT($result,0,"mime_type");
$image_width = @MYSQL_RESULT($result,0,"image_width");
$image_height = @MYSQL_RESULT($result,0,"image_height");
// Write blob data out to temp image file to prep for Watermark
// creating a temp image name
$t_img_name = tempnam ("./temp", "timg");
$t_img = fopen($t_img_name, "w");
// $content is the blob field with the image.
fwrite($t_img, $data);
fclose($t_img);
//-$size = getimagesize($t_img_name);
//echo $size[0]." - ".$size[1];
$img = imagecreatefromjpeg($t_img_name);
$watermarkImage = 'images/watermark2.png'
$x = 165;
$y = 130;
imagesetbrush($img, imagecreatefrompng($watermarkImage));
imageline($img, $x, $y, $x, $y, IMG_COLOR_BRUSHED);
imagejpeg($img);
// End of watermark protection
// don't forget to delete the temp file after all.
//unlink($t_img_name);
$type = "image/jpg";
if(strlen($data) < 1) {
header("Location: ./images/nopicsubmitted.jpg");
} else {
//header("Content-type: $type");
header("Content-Type: application/octet-stream");
echo $img;
}

Can anyone spot if i've made a mistake, used wrong function or syntax etc?

View Replies !
Change The Image Size (resolution) Of An Image Upload?
how can i change the image size (resolution) of an image upload? For example: i upload an 320x240 jpeg image. I want to automatic resize this image also to: 160x120 and 80x60.

View Replies !
Resize Uploading *.gif Image For Image Display And Thumbnail
how to resize the uploading *. gif image...for display image size and thumbnail size...Okay I know how to do a uploading image...only for resizing part kind of lost it...because I find all tutorial not suit for what I look after..Ok the idea is..

when I upload image ..the php will resize the image into two type size and put into two folder "folder for images" and "folder for thumb" and size for all this type of image are...images = 100x100 thumb = 80x80 with same name file.

View Replies !
How Do You Detect Image MIME Type Of An Image In A Directory?
How do you detect an image MIME type if you know of the image in a
directory? For example, I know of:

Code: ( php )

View Replies !
Resize Uploaded Image To A Circular In Shape Image.
I have a doubt. Using PHP  Image Manipulation  I want to resize uploaded image to a circular in shape image. Is it possible? If yes means how to do it!

View Replies !
Creating Watermark With Another Image & Resizing Watermarked Image
I have a script that watermarks an image; it adds a transparent gif over my base image. I also have a script to resize my image. But here is where the problem comes in; these are two different scripts - none of the code will interconnect (variable wise - that is), so I am having a problem trying to piece together a PHP GD Image code that will create a watermark and will then be resized. Below is my code for resizing my image, but from there - I know I need to use imagecreategif somewhere and imagecopy somewhere; but where, I do not know. Code:

View Replies !
Pulls An Image From A Database & Displays It In Print $image;
I have a routine that pulls an image from a database & displays it in print $image;

all works great however... Is there a way that i can set the size params of the image as when i set width & height is just returns a load of chars instead of the image itself.

View Replies !
Image Upload Query - Image Not Uploading To Server?
I have the below file upload script which seems to add the path to the database fine but it wont put the file onto the server and I cant see whats wrong. Code:

View Replies !
Getting Image (binary) From DB --> How To Make A 'true' Image
I'm storing images in a table as binaries (blobs)..now getting them out again to display them is no problem. What I want to do is get them out of the DB and using functions like getimagesize and such on them to make a thumbnail and dump that back in a separate table.
PHP Code:

View Replies !
Store Image On Datatable And Show Image
Store Image on datatable and show image. How could i store an image on table and show?

View Replies !
Get Image From DB Fails. Image Are Not Returned Correctly.
I have a problem retreiving images from a MSSQL 2000 database with php. I wrote an ASP page using "response.binarywrite" to get the same image, and this worked 100%. Therefore, the images in my database is not corrupt.
Only the top part of the image is returned to the client's browser window. Same result with both IE6 and Opera 7.11.
I guess the problem is header related, and I've tried to output different headers with no luck whatsoever.

Here is my php code:

getimagefromdb.php
-----------------------
<?php
error_reporting(E_ERROR);
header("Content-type: image/jpg");
$sql_servername = 'name_of_dbserver'
$sql_user = 'sql_user_name'
$sql_userpw = 'sql_user_password'
$db = 'database_name_where_images_is'

$query = "SELECT coverImage FROM dvds WHERE id = ".$_GET['ID'];
if (false != $conn = mssql_connect($sql_servername,$sql_user,$sql_userp w)) {
mssql_select_db($db,$conn);
$rs = mssql_query($query,$conn);
$arrImage = mssql_fetch_row($rs);
mssql_close($conn);
echo $arrImage[0];
}
?>

Next is a simple example of a page requesting image with ID=1:

index.php
-----------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
</head>
<body>
<table>
<tr>
<td>
Image: <img src="getimagefromdb.php?ID=1" />
</td>
</tr>
</table>
</body>
</html>

View Replies !
Creating Image From Uploaded Image And Transparent PNG
Say the client wants to be able to change the image, but not the text treatment, and doesn't have the Photoshop knowledge to actually replace it and re-save it themself.

Is there anyway to use a PNG with the rounded edges, text treatment, and transparent center, have the client upload a standard rectangular-shaped image, and use PHP to layer the uploaded image underneath the transparent one, creating a new image file?

View Replies !
Building An Image Tag Using An Image From A Diffrent Site
I am trying to edit a code so that images that are placed using a wysiwyg editor (live linked) would display, as of now only images residing on your server that are are displayed.

What would I change so that it could assemble the tag from anywhere, not only from my site ($mosConfig_live_site)? Code:

View Replies !
Image Upload Problem - New Image Not Displaying
I have a consistent problem that needs knocking on the head. I have an image upload script that uploads an image and replaces the old image. The image that is displayed is sometimes that old image and the page must be manually refreshed to get the new one. I need the new image to be displayed with out have to manually refresh the page.

So far I have identified the following:

•   Ive been testing in ie and firefox – the problem only happens in firefox.

•   If the upload script is activated more than once it works as desired – but not the first time. I need it to work the first time.

•   I have set the page to automatically refresh. – this works in ie, but firefox still needs a manual refresh.

•   I’ve included the following which makes no difference:

•   header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
•   header("Cache-Control: no-cache");
•   header("Pragma: no-cache");

View Replies !
Upload A Image That Should Be Resizid To A Small Image
when i upload a image it should be resizid to a small image..and while vewing the image after clicking on it shuld be enlarged.

View Replies !
Using Exec To Rotate And Lays An Image Over Another Image.
I'm using exec to rotate and lays an image over another image.
Here's the command:

composite -compose atop -geometry 200x200+10-10 "tmp/img1.tmp" -matte -background none -rotate 67 "tmp/img2.tmp" "tmp/img3.tmp"

It works in the newer version of imagemagick, but not the old. Anyone who can help me with a new command?

View Replies !
Pull Image From Mysql To Image Directory
Im trying to grab every image in my MySQL database then write them to a directory.
Thing is when I do this then view the image, it errors or shows the url of the image.
code:

View Replies !
Write Over An Existing Image Then Save It As A New Image.
I would like to offer a service to my members where they can select an image and their name and a script will generate a forum signature for them, basically i need to be able to write over an existing image then save it as a new image.

View Replies !
Image Array, Display One Image, With 'Next' Button
I need help building an array and have it display the $row[i] based on a $_GET variable number in the URL- I want to show one image from an album and have a 'NEXT' button so that I can cycle though all the images in that album.

This is a very small/simple gallery, all images will be in one table as shown below. Code:

View Replies !
Upload The Image Then Update A Page With The Image
Im trying to get PHP to upload the image then update a page with the image and the text inputted. I cant get the image upload to work. Code:

View Replies !
Upload An Image And Then Have The Image Resized Automatically
I need to be able to let the user upload an image and then have the image resized automatically and then store the image location in a database with a reference number (for example), so i can call only the images that are connected to the reference number.

View Replies !
Borken Image.. At The First Time..refresh The Image
I have one problem regarding broken image.. The problem is quite mystery..

It's happen to other user pc only (the page that we browse reside at
the same server)..not at my pc.. it never happen..

When other user go to the url. the face the broken image at the first
time and need to refresh their browser .. in order to see the image..
this is the e.g of the code.. Code:

View Replies !
Imagejpeg Generating String Not Image Even With Header("Content-type:image/jpeg")
does anyone know why i can't generate images with:
header("Content-type:image/jpeg");
imagejpeg($img_number);

i've tried different examples but i always get a text output as if the
header doesn't make a difference at all.

<?php
//random_number.php
$img_number = imagecreate(100,50);
$white = imagecolorallocate($img_number,255,255,255);
$black = imagecolorallocate($img_number,0,0,0);
$grey_shade = imagecolorallocate($img_number,204,204,204);

imagefill($img_number,0,0,$grey_shade);
ImageRectangle($img_number,5,5,94,44,$black);
ImageRectangle($img_number,0,0,99,49,$black);

header("Content-type:image/jpeg");
imagejpeg($img_number);
?>

View Replies !
Imagemagick - Position A Image On Top Of Another Image
I am trying to put a small transparent gif or png image in the top left corner of my images with imagemagick.

View Replies !
Image Generation For Dynamic Image
I've implemented the PHP Online poll available on this site, and it works great. But I'd like to increase the number of responses from 3 to at least 4 or 6. I've already implemented my changes to the MySQL DB, and all PHP code am having problems changing the graph.php code to all for 4 responses. It does the calculation correctly for the printed text, but nothing for the dynamic image. Any suggestions?

View Replies !
Image Handling & Image Quality
I'm using php to resize images on the fly but the quality diminishes for some reason.
These are the only image functions that I use:

$src = ImageCreateFromJpeg($image);
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0,
$tn_width,$tn_height,$width,$height);
header("Content-type: image/jpeg");
ImageJpeg($dst, null, -1);

Could you tell me what the problem might be?

View Replies !
Upload Image Default Image
I have this code for uploading images and would like to change it so that if there is no image uploaded it will place an url into the database (mysql) as the default image. Code:

View Replies !
Captcha Image Verification Can't See The Image
Captcha image verification working in my localhost (windows platform), it is not working in CentOS Linux 5 server.

I can't see the image from the server.

Have include gd.so module.

what setup is required for CentOS Linux 5 server?


View Replies !
Print The Image, But Get Broken Image
I store images on the disk and keep the details of the images in the database. All I want to do is print the image, but all I get is a broken image: PHP Code:

echo '<td align="center"><img src="../files/ '.$image1.' " /></b></br>'

"Files" is where the image is stored "$image1" is obviously what is stored in the database.

View Replies !
Replacing An Image With An Image Onclick
I am using a multi quote hack on my message board and it currently uses two images, one to add the quote and one to remove it. I want it to where there is only one button.

You click to add and the image switches to the remove image and then if you want to remove it, you click it and it goes back to the add button. Is this possible?? Code:

View Replies !
Image Resize - Skewed Image
I've been working on an upload form which includes uploading an image. I've got it to resize to the correct dimensions, but the images seem to become skewed. Heres an example: .....

View Replies !
Displaying Image From Image Path
Trying to display this simple query. Everything works but i can't get the image path correct. Its just displaying the image name.

   while ($row = mysql_fetch_array ($r)) { print "<p>{$row['title']} <br />
   {$row['address']} <br />
   {$row['description']} <br />
   {$row['price']} <br />
   <img src= "./uploads/images".{$row[['images']}"/>  <br />
   {$row['contact']} <br />
   {$row['phone']} </p>";

View Replies !
GD Image Library - One Single Odd Image
Have been using GD library, and have noticed one particular image that for some unfathomable reason doesn't want to stick to the max and min dimensions in the script I'm using. Code:

View Replies !
IE Image/pjpeg Instead Of Image/jpeg
I have an instance in PHP where I need to grab the extension for a certain mime type. So what I did was just grab all of the mime types and extensions from the mime.types file on my apache server.

Well the mime.types file does not have image/pjpeg it has image/jpeg. Why would I need image/pjpeg? Well because when uploading a jpg in IE $_FILES['field_name']['type'] = image/pjpeg. Code:

View Replies !
How To Create An Image From A Php Image.
I am trying to create an image from a .php. I was thinking of using fread and fopen, but I would like to use the GD libary. Any thoughts?

View Replies !
Image In Image String
I am using the imagestring function, where a string of text is displayed over an image.
PHP Code:

View Replies !
Loading One Image On Top Of Another Image
I want to load an image and position it over another background image before sending it to the browser (I think the example I saw before involved a treasure map and a set of co-ordinates marking where a flag was to be put). I can use imagecreatefromgif(), but I can't see how to add the second image. Any suggestions?

View Replies !
Fopen Image With A GD Image
I have a PHP script which creates an image using GD and I'm trying to read its contents with PHP. When the file physically exists on the server, I can fopen it and use fread to read it. Is there a way to get the same results with a PHP page?

View Replies !
How To Save The Image When Using Image On The Fly
Can anyone help me with the code to save the image generated on the fly, I can always do right click and save picture, but it needs to be done in the program. The below program generates a random number and makes an image out of it and displays it. However I want to save the generated image, preferably with the same random it generates or simply the name 00001.png thru 10000.png etc

I can save a copy this way, but I must have a copy already saved by that name for it to work. I guess it saves over the old one.

ImagePNG($im, "test.png");

The below works fine, but it is on screen and is not saved. I want to save each image automatically under a sequential name as the images are generated.

ImagePNG($im);

As you can see, if the old image is on disk, it writes over the old and I have a new on the fly image saved, but the test.png must be on the server for this to work.

<img src="test.png"><br>

<?php
header("Content-type: image/png");
$new_string;
session_register('new_string');
$im = ImageCreate(60, 20);
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
srand((double)microtime()*1000000);
$string = md5(rand(0,9999));
$new_string = substr($string, 17, 4);
print $new_string;
ImageFill($im, 0, 0, $white);
ImageString($im, 8, 12, 3, $new_string, $black);
// ImagePNG($im, "test.png");
ImagePNG($im);
ImageDestroy($im);
?>

View Replies !

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