Php :: Adding Image Over Image

free web hosting
Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Php :: Adding Image Over Image

Zeeshan Hashmi
Hi Masters & Champions.

I want some help regarding putting and image over some location (x pixel , y pixel) of an image. Here it is quite important to note that the mage which is Inserted over an image must be clickable. Like for example suppose i put T on an image DD then the T must be clickable. Please gudie as this is quite important for me .

Thanks

Reply

Niran
Using div tags you can use like this!!
enclose both the images in seperate div tags!
specify the top and left positions of the image in that div tag itself using style sheet!

and the imporatant thing is, you need to specify the z-index field for both the div tags!
The image needs to be appeared on top should have a higher z-index than the image to be appeared in bottom!

Dont forget to specify the position attribute! biggrin.gif

I'm giving one example here:


<div style="top:10px; left:10px; z-index:1; position:absolute"> <!--Bottom layer -->

<img src="BottomImagesource.jpg" width="" height="" /> <!-- Image to be displayed bottom -->

</div>



<div style="top:40px; left:30px; z-index:2; position:absolute"> <!--Top layer -->

<img src="YopImagesource.jpg" width="" height="" /> <!-- Image to be displayed on top -->

</div>


This code will display the 2nd div layer with higer z-index value ( here it is 2 ) over the 1st layer having lower z-index value (here it is 1)


[Note: there is no need of any php as specified in the topic title biggrin.gif ]

 

 

 


Reply

Zeeshan Hashmi
thannks NIran, great help. But please let me know how to make the TOP image Click able. Like I have a map and on that map i want to put one of this PIN http://www.awesomebackgrounds.com/templates/map-pin1.GIF and i want this PIN to be Clickable. Please guide and give some idea how to get it done Dynamically through PHP ?

Reply

Niran
QUOTE(Zeeshan Hashmi @ Sep 21 2006, 10:23 PM) *

thannks NIran, great help. But please let me know how to make the TOP image Click able. Like I have a map and on that map i want to put one of this PIN http://www.awesomebackgrounds.com/templates/map-pin1.GIF and i want this PIN to be Clickable. Please guide and give some idea how to get it done Dynamically through PHP ?


thats simple friend! cool.gif
Just use the <a> tag around the 2nd image (in the second layer) which will be displayed on top!
That will make the second image alone as clickable one!

Modified code will be like this:
(for the 2nd div tag with z-index of 2)



<div style="top:40px; left:30px; z-index:2; position:absolute"> <!--Top layer -->

<a href="yourUrlPath"> <!-- Url for the top Image -->

<img src="YopImagesource.jpg" width="" height="" /> <!-- Image to be displayed on top -->

</a>

</div>

Reply

Zeeshan Hashmi
Ok thanks a lot. Great Help !!


Reply

TavoxPeru
QUOTE(Zeeshan Hashmi @ Sep 21 2006, 11:53 AM) *

thannks NIran, great help. But please let me know how to make the TOP image Click able. Like I have a map and on that map i want to put one of this PIN http://www.awesomebackgrounds.com/templates/map-pin1.GIF and i want this PIN to be Clickable. Please guide and give some idea how to get it done Dynamically through PHP ?

Well for example if you have a table that store some attributes of any image like its filename, URL, Xposition, Yposition, width and height and by a html form someone selects an image you only need something like this code:
CODE
<?php
// the id of the selected image
$id=$_POST["id"];  

// database settings and connection
include("db.php");

// data selection
$query="select * from ImageTable where id=$id";
$rs = mysql_query($query) or die("Erro No: ".mysql_errno() . "<br />Description: " . mysql_error());
$row=mysql_fetch_array($rs);
?>
<!-- Image display -->
<div style="top:10px; left:10px; z-index:1; position:absolute"> <!--Bottom layer -->

<img src="BottomImagesource.jpg" width="" height="" /> <!-- Image to be displayed bottom -->

</div>

<div style="top:<?php echo $row["Xposition"]; ?>; left:<?php echo $row["Yposition"]; ?>; z-index:2; position:absolute"> <!--Top layer -->

<a href="<?php echo $row["URL"]; ?>"> <!-- Url for the top Image -->

<img src="<?php echo $row["filename"]; ?>" width="<?php echo $row["width"]; ?>" height="<?php echo $row["height"]; ?>" /> <!-- Image to be displayed on top -->

</a>

</div>

Also note that its not necesary to store the width and height of the image because you can obtain it directly with the get_imagesize() function.

Best regards,

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Recent Queries:-
  1. display "image over image" html - 78.24 hr back. (1)
Similar Topics

Keywords : php, adding, image, image

  1. Dynamic Php Image And Better Php Code Question
    (10)
  2. Dynamic Gd Image
    (2)
    I dont know if someone already made a topic like this, however it's not hard to understand if
    you can php, as many know we need to start a php script with CODE and end with CODE ?>
    to make a image you need a image type, I choos .png because its much cleaner then .jpg CODE
    header("Content-type: image/png"); for the background for the image we need this code CODE
    $image = imagecreatefrompng("http://www.imagefilez.com/out.php/i252132_Userbar.png"); if we wont
    a text in the image we need a font color, we get our font color from HEX values ....
  3. Image Popup On Mouseover
    (23)
    I need a script that does this: Lets say I have form with options...you surely know what that is...
    CODE Who do you wanna race?           Derbi Senda 50      Honda NS 50 R      Suzuki ZR
    50      Yamaha DT 50 MX      Aprilia RS 50      - ?         When i put my mouse over
    one of them i want a picture of bike on which your mouse is on to pop up... I hope you understand
    what i mean...i can't rephrase it to be more meaningful...i tried /wink.gif"
    style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />....
  4. Need Help With Background Image...
    (12)
    I want to add background image to all sites on my website but some include "foot.php" and "head.php"
    and some "footer.php" and "header.php" but all include "config.php" but i dont know in which should
    i put it....any help??....
  5. Adding Security Enhancements To Php Programs
    Security enhancements of PHP programs (0)
    PHP is becoming the language for even general programming more as it has seen from PHP4 to PHP5. PHP
    originally started as CGI script language connected with the internet. Thus, PHP is closely related
    with the internet and security - whether the problem comes from security leak point of internet
    protocols or not - problems related to the internet. There are two major security issues when your
    PHP program(s) has something to do with the internet. There can be memory leak and security leak
    from the program of PHP not connected - or connected - to the internet by PHP settin....
  6. Php :: Image Pixel Per Inch And Conversion
    Please Guide (1)
    Hi Masters I want soemone to let me know (maybe through a good tutorial and/or PHP Sample Code)
    the following : 1 - User will only allowed to upload images with minimum 120 and maximum 300 Pixel
    Per Inches 2 - User will only allowed to upload JPG images, however, if Gif / BMB / PNG / ETC is
    uploaded the script will convert that into jpg. 3 - If the Image's PPI is > 300 it will set
    to 300. Please guide . I know this can'y be done by GD it requires ImageMagick, Pleae help
    !!!!!!! ....
  7. Image Works With Php And Gd
    (3)
    Hi I have a 1 Big map. What i want is that the user will enter the latitude and longitude. the
    script will show that location in the image. I know how to convert Image X,Y Coordinates into
    Latitide and Longitude and vise versa. But there point is that the image is 1000x1000 wide but i
    want to show only the particular region of that latitude / longitude in 300x300 image. means that
    the PHP script will CROP wht Image (1000x1000) to 300x300. That way, the script will be shoing the
    part of an image, not the whole image. please help !!....
  8. Script For Viewing A Random Image Needed
    (3)
    While browsing the web, I bumped into a script that I could really use, since it's different
    from everything that I saw. Most scripts that view a random image contain a code that chooses an
    image, and then puts the part into the page itself. However, on the www.greenplastic.com web
    site (dedicated to Radiohead), in the top left corner there is a random image module. If you look at
    the code, here's what is used: CODE Now, how can a PHP script be an image, and what
    kind of script that is? If you do visit that URL , you don't get a normal page, b....
  9. Php Question Re Adding A Link
    inside a top frame (2)
    I have a directory site that someone else programmed for me a couple of years ago. I have been
    making my own modifications to the script, and generally not running into many issues, since the
    changes are usually pretty basic. When a visitor clicks on a category, it takes them to a category
    page which lists all the sub categories, and under each category is a list of the links in it. When
    you click on one of the links, it takes you to a frame page. I have a tiny frame across the top
    which allows them to stay within the site. (Q) I would like to add a tiny link in my ....
  10. Friend Networking Script... Help!
    Adding & removing friends (1)
    I'm creating my own friend network script which is going to be a combo of MySpace/Facebook and
    an AIM profile. One of the most important features is the adding of friends. The way to do this is
    probably simple & I'll kick myself when I see the code to do it. What needs to happen is a
    friend clicks a link which sends an internal message through the scripts messaging system (like a PM
    on a forum) to the other person to approve or deny the request. In that message, there needs to be a
    link to a page which executes a PHP script which updates the database adding b....
  11. How Do I Resize An Image On The Fly?
    (8)
    I was wondering how I would go about resizing an image from a databse without saving it to a file.
    CODE include("settings.inc.php"); $get_a=$_GET ; $get_b=$_GET ; $get_width=$_GET ;
    $get_height=$_GET ; $query="SELECT * FROM $get_a WHERE id='$get_b'";
    $result=mysql_query($query); $image=mysql_result($result,0,"coverimg");
    $size=mysql_result($result,0,"imagesize"); $type=mysql_result($result,0,"imagetype");
    header("Content-length: $size"); header("Content-type: $type"); echo $image; ?> Obviously the
    image I want to resize is $image. The page name....
  12. Need Help Is Adding A PHP Based News Module To My Site
    (2)
    Hey guys i need a simple help i'm builing a homesite and i have a little spot for news. Well i
    just place there the Topics and add a link to another page "news.php". Well its obvious that i dont
    want to build a file for each news that i have so i know that exists a way to work with SQL & PHP. I
    will show want i'm doing CODE        require ('mysql.php');       
    $query="SELECT * FROM News ORDER BY `data` ASC LIMIT 0,5 ";        $result=mysql_query($query);
               $num=mysql_num_rows($result); mysql_close(); echo " Outras Other News "; $i=....
  13. Uploading Image Via Admin Menu?
    (2)
    There's never much action in here. Here's a question for all you php guys out there.
    Here's what I want. Let's say I create a simple administration menu for someone to
    Add/Edit/Delete a record/item from a database. Now in the add function, let's say I want to
    store a URL to a image. Rather than having to go in and FTP that image up on the server, how could
    a person create a 'Browse' button and find that image on your harddrive, then create a
    script to upload the image to the server? Just wondering how to do it, or if it could be done e....
  14. How Do I Make PHP Based Image Gallery Like This?
    Help Needed (20)
    is it possible to make a page in php, with a url like this:
    httq://www.mysite.com/viewer.php?http://www.mysite.com/galleries/01 (This is a sample link, read
    below) so that in what i change the last part the gallery will change with it? so that i just have
    to make one php-page and this page just shows all the imaes in the map thats in the url after the
    questionmark?? thanks,....
  15. Saving A Php Generated Image To The Server
    Help Needed Please (5)
    I'm trying to create a script that will generate an image and send it back to the browser while
    saving the same image to the server. I'm doing this because the image should be dynamically
    generated but because of the load that would place on a server if the image happened to be requested
    frequently, I've decided to build in a means to serve the static version of the image most of
    the time. What isn't included here is the function that will check the age of the file in cache
    directory and serve the static image if it is less than an hour old. This isn....
  16. Is It Possible To Create A String Image In Chinese
    (0)
    CODE Using imageloadfont $im = imagecreate(50, 20); $black = imagecolorallocate($im, 0, 0, 0);
    $white = imagecolorallocate($im, 255, 255, 255); imagefilledrectangle($im, 0, 0, 49, 19, $white);
    $font = imageloadfont("04b.gdf"); imagestring($im, $font, 0, 0, "Hello", $black); imagepng($im); ?>
      This is an example for illustrating how to create a image including a string with a specific
    font. In the codes, a font named "04b.gdf" is loaded and the string is created according to the
    font. What is the font named gdf? I mean what's the limitation or specificatio....
  17. Php: Write Random Text As Image
    Having problems, help needed! (3)
    I'm trying to create a script that writes text to an image. CODE header("Content-type:
    image/png"); $_phrases = array( "Test 1", "Test 2", "Test 3", "Test 4", "etc." ); $_rand_phrase
    = $_phrases ; $_image = imagecreatefrompng("gmail.png"); $_user_width =
    imaagettfbbox(9,0,"tahoma.ttf",$_rand_phrase); $_x_value = (200-($user_width + 113)); $_color =
    imagecolorallocate($_image, 165, 164, 164); imagettftext($_image, 9, 0, $_x_value, 16, $_color,
    "tahoma.ttf", $_rand_phrase); imagepng($_image); imagedestroy($_image); I can't see what
    I'm doing wron....
  18. Forum Signature-image With Php
    Use PHP to create an image in real-time (8)
    With interest I have read these Topics. What I want to do with PHP is the following:
    Signatue-image This is the Forum Signature of my cousin, who lives in Europe. The image is
    generated in real-time. (Refresh the page, and see for yourself) My cousin refuses to tell me how
    he did this. But I want to do the same thing, also with PHP. Any ideas? Greetings, John. This
    is NOT a tutorial and in future you should be more careful about where you're posting your
    threads. Moved to Programming > Scripting. ....
  19. Random Image / Random Header
    S.O.S. (5)
    im building a website, and i need some help i got 3 frames, navigation, top and main, but i want
    the top banner to have a new tagline with every refresh, just like the header, it dont really matter
    what coding it is, as long as it's not to weird /tongue.gif' border='0'
    style='vertical-align:middle' alt='tongue.gif' /> ....

    1. Looking for php, adding, image, image






*SIMILAR VIDEOS*
Searching Video's for php, adding, image, image
advertisement




Php :: Adding Image Over Image