hii,
I have 3 images for a single id like 00024 in the DB. when ever the user selects the ID from the drop down .all the 3 images must be displayed . how do i do this?
this is the image script i use and display images like
<img src='/diabetes/visitimages/thumbpicdisplay.php?id=<?php echo $id ?></img> - <?php
-
-
include_once('../db.php');
-
-
$sql = "SELECT image FROM rop_images WHERE Patient_id='".$_GET['id']."'";
-
-
$result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
-
-
header("Content-type: image/jpeg");
-
$test=mysql_result($result,0);
-
-
$desired_width = 80;
-
$desired_height = 80;
-
-
$im = imagecreatefromstring($test);
-
$new = imagecreatetruecolor($desired_width, $desired_height);
-
-
$x = imagesx($im);
-
$y = imagesy($im);
-
-
imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y);
-
-
imagedestroy($im);
-
header("cache-Control: no-cache, must-revalidate"); // HTTP/1.1
-
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
-
header('Content-type: image/jpeg');
-
imagejpeg($new, NULL, 85);
-
-
imagedestroy($new);
-
// echo $test;
-
-
mysql_close($link);
-
?>
-
8 8323 Atli 5,058
Expert 4TB
Hey.
How do you differentiate between the three images?
Generally, though, you would just pass ALL the identifiers required to query the specific image from the database, and have the script fetch and display it. - <img src="getimg.php?parent_id=1&size=32" alt="32 px thumb">
-
<img src="getimg.php?parent_id=1&size=64" alt="64 px thumb">
-
<img src="getimg.php?parent_id=1&size=128" alt="128 px thumb">
- <?php
-
$parent_id = (int)$_GET['parent_id'];
-
$thumb_size = (int)$_GET['size'];
-
-
if($parent_id > 0 && $thumb_size > 0)
-
{
-
$sql = "SELECT `data`, `mime`
-
FROM `thumbs`
-
WHERE `parent_id = {$parent_id}
-
ADN `size` = {$thumb_size}"
-
-
// etc...
-
}
-
?>
See what I mean?
yeah that was the way i was doing .
Now the requirement is that we have to display all the images from Db regarding a Id.So we have a dropdown with all the Id's . when the user changes the ID the images from get displayed .
since i am using jquery . i asked this question how do i do using jquery and another problem is that . there can be any number of images corresponding to a ID say ( 0006) .
i have a small idea on this . please help me executing this using jquery.
when ever the dropdown is changed , i call a function and i fetch the rowid(auto incremented value) and actual id from the Db . and make it into a array in a php file and then return it back in a array to the jquery .
like - ("#dropdown").change(function(){
-
$.post("change.php",{ state:$("#id").val()} ,function(data){
-
-
// get the count count(array) so that we know number of images .
-
//loop through the array and print the images
-
// how do i do the previous 2 steps ?
-
// instead of state:$("#id").val() can i pass value like state: <?php echo $id ?> ??
-
});
-
});
no help on this problem ?
- $.post("/diabetes/ropimages/getcount.php",{pid:$("#patient_id").val()} ,function(data1){
-
//alert(data1);
-
var count = data1;
-
var pid = $("#patient_id").val();
-
var rid;
-
for( var i = 1 ; i <= count ; i++)
-
{
-
var link ='<img src="/diabetes/ropimages/thumbpicdisplay.php?pid=+pid+&rid=1" />';
-
$("#content1").empty().html(link);
-
}
-
});
i am trying to pass pid value in url ..but its taking directly as +pid+ as value ..how do i give it the value of pid. and how do i print 3 images in a div ? like the one in code
i finally wrote code like this.. - $.getJSON("/diabetes/ropimages/getcount.php",{pid:$("#patient_id").val()} ,function(data1){
-
-
var i;
-
var count = data1.count;
-
-
var start = data1.start;
-
-
var pid = $("#patient_id").val();
-
-
-
for(i = start ; i <= count ; i++)
-
{
-
var link ='<a href="/diabetes/ropimages/origpicdisplay.php?pid='+pid+'&rid='+i+'"><img src="/diabetes/ropimages/thumbpicdisplay.php?pid='+pid+'&rid='+i+'"/><a>';
-
alert(link);
-
if(i > start)
-
{
-
$("#content1").append(link);
-
}
-
else{
-
$("#content1").empty().html(link);
-
}
-
-
}
-
},"Json");
for the 1st loop it works ..then it stops printing the images...can u just tell me whts the problem? its not coming inside the loop itself, i checked giving the alert statement inside the loop.
finally i solved the problem by writing code like this. - $("#patient_id").change(function(){
-
-
$.getJSON("/diabetes/ropimages/getcount.php",{pid:$("#patient_id").val()} ,function(data1){
-
-
-
var link = "";
-
-
var count = parseInt(data1.count);
-
var start = parseInt(data1.start);
-
var pid = $("#patient_id").val();
-
-
-
count = parseInt(count)+parseInt(start);
-
-
if(count > 0){
-
for(var i= parseInt(start); i < parseInt(count); i++)
-
{
-
-
link ='<a href="/diabetes/ropimages/origpicdisplay.php?pid='+pid+'&rid='+i+'"><img src="/diabetes/ropimages/thumbpicdisplay.php?pid='+pid+'&rid='+i+'"/><a>';
-
-
if(i > start){ $("#content1").append(link);}
-
-
else{ $("#content1").empty().html(link);}
-
}
-
}
-
else{ $("#content1").html("No Images uploaded");}
-
},"Json");
-
-
});
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Peter Lapic |
last post by:
I have to create a image web service that when it receives an imageid
parameter it will return a gif image from a file that has been stored on the
server.
The client will be an asp.net web page...
|
by: Gale |
last post by:
I'm working on something in jQuery with XPath
What I want to do is: if checkbox is checked, set background color od
label that contain input(checkbox) to red
I have this code:...
|
by: ziobudda |
last post by:
Hi, I want ask you if, for a web portal/application, is better
prototype or Jquery? I don't want to innesc some type of flame, but
after the announce that drupal use JQuery and that the new...
|
by: darrel |
last post by:
I'm still struggling to find a javascript/ajax library that I want to stick
with for a while.
JQuery is looking great these days...refined, LOTS of plug-ins, and an
active community.
Is...
|
by: DuaneMoraes |
last post by:
A new book on jQuery, the powerful JavaScript library, has been announced by Packt In Learning jQuery, Karl Swedberg and Jonathan Chaffer, creators of the popular jQuery learning resource...
|
by: mikeh3275 |
last post by:
I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to...
|
by: liketofindoutwhy |
last post by:
I am learning more and more Prototype and Script.aculo.us and got the
Bungee book... and wonder if I should get some books on jQuery (jQuery
in Action, and Learning jQuery) and start learning about...
|
by: RobG |
last post by:
Do some of the regulars here need to re-think their (sometimes
strident) opposition to libraries? Both Microsoft and Nokia have
announced support for jQuery.
It seems to have gained quite a bit...
|
by: souporpower |
last post by:
Hello All
I am trying to activate a link using Jquery. Here is my code;
<html>
<head>
<script type="text/javascript" src="../../resources/js/
jquery-1.2.6.js"</script>
<script...
|
by: pavanip |
last post by:
Hi,
I want to popup aspx page using jquery. I have written the following code
<a href="Contactus.aspx?TB_iframe=true&height=250&width=200" class="thickbox" >AboutUs</a>
I have called...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |