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 28 October 2002, 06:13 PM
  #1  
BoxerFlat4
Scooby Regular
Thread Starter
 
BoxerFlat4's Avatar
 
Join Date: Nov 2001
Location: N Wales
Posts: 923
Received 0 Likes on 0 Posts
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.

Old 28 October 2002, 11:07 PM
  #2  
ptholt
Scooby Regular
 
ptholt's Avatar
 
Join Date: Dec 1999
Posts: 3,846
Likes: 0
Received 0 Likes on 0 Posts
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).

Old 29 October 2002, 12:14 AM
  #3  
legacyPete
Scooby Regular
 
legacyPete's Avatar
 
Join Date: Dec 2001
Posts: 202
Likes: 0
Received 0 Likes on 0 Posts
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]
Old 29 October 2002, 01:26 AM
  #4  
BoxerFlat4
Scooby Regular
Thread Starter
 
BoxerFlat4's Avatar
 
Join Date: Nov 2001
Location: N Wales
Posts: 923
Received 0 Likes on 0 Posts
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.



Old 29 October 2002, 10:46 AM
  #5  
AdrianFRST
Scooby Regular
 
AdrianFRST's Avatar
 
Join Date: Oct 2000
Posts: 368
Likes: 0
Received 0 Likes on 0 Posts
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
Old 29 October 2002, 10:51 AM
  #6  
BoxerFlat4
Scooby Regular
Thread Starter
 
BoxerFlat4's Avatar
 
Join Date: Nov 2001
Location: N Wales
Posts: 923
Received 0 Likes on 0 Posts
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 ?
Old 29 October 2002, 12:04 PM
  #7  
AdrianFRST
Scooby Regular
 
AdrianFRST's Avatar
 
Join Date: Oct 2000
Posts: 368
Likes: 0
Received 0 Likes on 0 Posts
Post

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

Should explain.
Old 29 October 2002, 02:32 PM
  #8  
Dream Weaver
Scooby Regular
 
Dream Weaver's Avatar
 
Join Date: Feb 2000
Location: Lancashire
Posts: 9,844
Received 0 Likes on 0 Posts
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?
Old 04 November 2002, 03:57 PM
  #9  
BoxerFlat4
Scooby Regular
Thread Starter
 
BoxerFlat4's Avatar
 
Join Date: Nov 2001
Location: N Wales
Posts: 923
Received 0 Likes on 0 Posts
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.
Old 04 November 2002, 04:36 PM
  #10  
legacyPete
Scooby Regular
 
legacyPete's Avatar
 
Join Date: Dec 2001
Posts: 202
Likes: 0
Received 0 Likes on 0 Posts
Post

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



Quick Reply: Dreamweaver MX Server Behaviours, Dynamic Images ?



All times are GMT +1. The time now is 03:09 PM.