Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Dreamweaver MX Server Behaviours, Dynamic Images ?

Thread Tools
 
Search this Thread
 
Old Oct 28, 2002 | 06:13 PM
  #1  
BoxerFlat4's Avatar
BoxerFlat4
Thread Starter
Scooby Regular
 
Joined: Nov 2001
Posts: 923
Likes: 0
From: N Wales
Question

Anybody know of a server behaviour for Dreamweaver that allows me to take an image, taken from a RecordSet, and display it ? I've got a PHP file, reading in a BLOB object from a mySQL database, but I want to be able to display the object as an image.

I realise I could get my hands dirty and code it myself in the PHP, but wondered if the server behaviours had been written already by anybody in Dreamweaver.

Reply
Old Oct 28, 2002 | 11:07 PM
  #2  
ptholt's Avatar
ptholt
Scooby Regular
 
Joined: Dec 1999
Posts: 3,846
Likes: 0
Post

I thought this was the whole of point of dreamweaver doing the php code for you so you can just drag and drop?

(am working on something identical to you by the sound of it lol).

Reply
Old Oct 29, 2002 | 12:14 AM
  #3  
legacyPete's Avatar
legacyPete
Scooby Regular
 
Joined: Dec 2001
Posts: 202
Likes: 0
Post

Forget Dreamweaver objects, just do it yourself. Anyway, if the PHP code Dreamweaver writes is like the ASP code it generates, then it's fit for the bin.

Just use this script to output an image:

img.php:

<?
if($_GET[id]) {
$link = mysql_connect ('localhost', 'user', 'pass');
mysql_select_db('db');

header("Content-Type: image/jpeg");
$imgquery = mysql_query("select the_binary_data from my_table where row_id = $_GET[id]") or die (mysql_error());
$data = mysql_fetch_row($imgquery);
echo $data[0];
}
?>

---------------------------------------------------------------

Then to output an image on a page just add image tags:

<img src="img.php?id=your_id_here">

[Edited by legacyPete - 10/29/2002 12:15:06 AM]

[Edited by legacyPete - 10/29/2002 12:34:47 AM]
Reply
Old Oct 29, 2002 | 01:26 AM
  #4  
BoxerFlat4's Avatar
BoxerFlat4
Thread Starter
Scooby Regular
 
Joined: Nov 2001
Posts: 923
Likes: 0
From: N Wales
Post

ptholt - problem with relying on drag and drop code is, if you don't have the behaviours pre-coded, your stuffed !

legacyPete - thanks for the example, using Dreamweaver server behaviours is only a temporary thing until I get around to writing some proper PHP to code up my website from a full database.



Reply
Old Oct 29, 2002 | 10:46 AM
  #5  
AdrianFRST's Avatar
AdrianFRST
Scooby Regular
 
Joined: Oct 2000
Posts: 368
Likes: 0
Post

I'd advice against storing the image in the database, and instead just storing the location of the file.

Here's why (ASP & MS SQL but principals still apply):

http://aspfaq.com/show.asp?id=2149
Reply
Old Oct 29, 2002 | 10:51 AM
  #6  
BoxerFlat4's Avatar
BoxerFlat4
Thread Starter
Scooby Regular
 
Joined: Nov 2001
Posts: 923
Likes: 0
From: N Wales
Post

Cheers for that, AdrianFRST -

Looking at my own application, I think storing the images in the database is still valid. I'll always have a copy of the database on a local machine, hence a valid backup, and since the database is going to be used to drive a product based web site, it gives me greater flexibility then storing references to file images. Last thing I want to have to do is sort out where images are kept, while the reference is called, maintaining it all when it changes, etc etc.

One thing I hadn't considered was the potential 2GB limit - does anybody know if mySQL has this limitation ?
Reply
Old Oct 29, 2002 | 12:04 PM
  #7  
AdrianFRST's Avatar
AdrianFRST
Scooby Regular
 
Joined: Oct 2000
Posts: 368
Likes: 0
Post

http://www.mysql.com/doc/en/Table_size.html

Should explain.
Reply
Old Oct 29, 2002 | 02:32 PM
  #8  
Dream Weaver's Avatar
Dream Weaver
Scooby Regular
25 Year Member
Liked
 
Joined: Feb 2000
Posts: 9,846
Likes: 4
From: Lancashire
Question

Adrian - i've had a look at this ASPUpload thing for a while now, but cant really figure out what the thing is. From playing with it, it looks like it stores the images in the db as long binary data, which doesn't really alleviate the stored image problem.

The bit that confuses me is this. Say I create an admin section, where the user can upload an image for a new product. They generally upload HUGE files from digicams etc. I then want the image to be stored on the server, and be passed through a resize component to resize it to a set number of pixels/size. The web pages will then draw the images from the folder using the image name and location which is given to the product at runtime.

But where do you declare where the images are uploaded to, and what do you do about server usernames/passwords?

So how we do that then?
Reply
Old Nov 4, 2002 | 03:57 PM
  #9  
BoxerFlat4's Avatar
BoxerFlat4
Thread Starter
Scooby Regular
 
Joined: Nov 2001
Posts: 923
Likes: 0
From: N Wales
Post

legacyPete -

The section of code you've got above - should that be working ? I'm not convinced that this :-

img src="img.php?id=your_id_here...

:- is actually calling the php file img. All I seem to get is an image tag trying to draw the img.php file.

Could someone confirm/deny the syntax of the above code for me ?

Ta.
Reply
Old Nov 4, 2002 | 04:36 PM
  #10  
legacyPete's Avatar
legacyPete
Scooby Regular
 
Joined: Dec 2001
Posts: 202
Likes: 0
Post

Yeah, it works - try running img.php?id=whatever by itself in a browser and see if it is giving any error messages.
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
hardcoreimpreza
Computer & Technology Related
21
Oct 11, 2015 03:40 PM
Brumguy34
Subaru Parts
8
Oct 4, 2015 07:51 PM
powerwrx
Non Scooby Related
21
Oct 3, 2015 11:31 PM
Ganz1983
Subaru
5
Oct 2, 2015 09:22 AM
johnnybon
Subaru Parts
13
Sep 29, 2015 10:47 PM




All times are GMT +1. The time now is 11:57 PM.