You are here: Re: help with framing a pic « All PHP « IT news, forums, messages
Re: help with framing a pic

Posted by Ashok on 06/28/05 00:27

Hi,
I am getting the frame with the script but only if I state direct path to
image directory and pic. What I need is I get pics dynamically from
database.
I am not getting it anyway.
So, if I tell
<?php ds("images/testpic.jpg",100,"big magic"); ?>
it works,
but if I tell
<?php ds("images/$pic_id",100,"big magic"); ?>
it doesnt.
Any ideas?

Ashok.

"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
news:mmiob1pi4c4i1i4k9402o21238bqvrcq5f@4ax.com...
> I noticed that Message-ID: <d9gupo$7mh$1@gavrilo.mtu.ru> from Ashok
> contained the following:
>
> >In short, something like www.framenview.com but not so complex. Just the
> >picture and frames, and on selecting the frame thumbnail, picture gets
> >framed.
>
> My dropshadow function effectively puts a frame on two sides
> www.ckdog.co.uk/phdropshad/
>
> Extending that a bit gives you framing
> www.ckdog.co.uk/phdropshad/corners.php
>
> You need to create 8 images for the frame, thought this is really two
> images rotated. You have 4 corners and 4 sides Call the function like
> so ds(path to image, frame width, alt text) to display the framed
> image. And it does it with divs, not tables.
>
> Code follows:
> <?php
> //define paths to border images
> define("BOT","images/bot.gif");
> define("TOP","images/top.gif");
> define("LEFT","images/left.gif");
> define("RIGHT","images/right.gif");
> define("TOP_LEFT","images/tl.gif");
> define("TOP_RIGHT","images/tr.gif");
> define("BOT_RIGHT","images/br.gif");
> define("BOT_LEFT","images/bl.gif");
>
>
> function ds($image,$dsw,$alt){
> //first check that file exists
> if(file_exists($image)){
> //create an image from the file
> $img=ImageCreateFromJpeg($image);
> //print containing <div> using image width plus shadow width
> print "<div style='width:
> ".(imagesx($img)+$dsw+$dsw)."px;margin:0px'>\n";
> //print topleftcorner
> print "<img style='float: left;' src='".TOP_LEFT."'
> height='$dsw' width='$dsw'alt='$alt'>\n";
> //print topline
> print "<img style='float: left;' src='".TOP."' height='$dsw'
> width='".imagesx($img)."'alt='$alt'>\n";
> //print toprightcorner
> print "<img style='float: left;' src='".TOP_RIGHT."'
> height='$dsw' width='$dsw'alt='$alt'>\n";
> //print leftline
> print "<img style='float: left;' src='".LEFT."'
> height='".imagesy($img)."' width='$dsw'alt='$alt'>\n";
> //print image
> print "<img style='float: left;' src='$image'
> height='".imagesy($img)."' width='".imagesx($img)."'alt='$alt'>\n";
> //print right shadow using image sizes
> print "<img style='float: left;'
> src='".RIGHT."'height='".imagesy($img)."'width='$dsw'alt=''>\n";
> //print bottomleftcorner
> print "<img style='float: left;' src='".BOT_LEFT."'
> height='$dsw' width='$dsw'alt='$alt'>\n";
> //print bottom shadow using image sizes
> print"<img style='float: left;'
> src='".BOT."'width='".imagesx($img)."'height='$dsw'alt=''>\n";
> //print corner shadow using image sizes
> print "<img style='float: left;'
> src='".BOT_RIGHT."'height='$dsw'width='$dsw'alt=''>\n";
> //print closing </div>
> print "</div>\n";
> }
> }
>
>
> --
> Geoff Berrow 0110001001101100010000000110
> 001101101011011001000110111101100111001011
> 100110001101101111001011100111010101101011

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация