473,769 Members | 4,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic image loading

Hi All,

Here's what I'm trying to do.

I have a diverse customer base, and as it grows, it's increasingly harder to
figure out what aspect of our web site is selling and what is not. So I've
been trying to use PHP (and/or ASP) to do some research on my customers. So
I nosed around some web sites and found the following piece of code.

<IMG
SRC="http://rs6.net/on.jsp?t=101127 4772185.1011242 055951.10112002 90023.5850&
o=http://ccprod.roving.c om/roving/images/p1x1.gif" WIDTH=1 HEIGHT=1 alt=" ">

Here's what I understand from it ... this image source is actually a JSP
that does some statistics generation after which the actual image is loaded.
I tried doing this with an ASP and PHP page but I don't know what type of
code would go into the proper code to actually return an image to the
calling HTML.

In summary, I e-mail a page to my clients. Their HTML enabled mail software
opens my mailout, and in the process of loading up a key image on the page,
my backend PHP updates my MySQL server about this activity.

So can someone please explain to me how I can achieve this objective?

Thanks so much.

- Z -
Jul 17 '05 #1
5 2719
OneSolution wrote [edited]:
<IMG SRC="--censored--.gif" WIDTH=1 HEIGHT=1 alt=" ">
Shouldn't the alt attribute be "web bug"? :-)
So can someone please explain to me how I can achieve this objective?

You already posted the solution.
Just make a script that saves /whatever/ to the database and outputs an
image.
<?php
save_to_db($wha tever);
output_img($web bug);
?>
Easy!

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2
> <IMG
SRC="http://rs6.net/on.jsp?t=101127 4772185.1011242 055951.10112002 90023.5850& o=http://ccprod.roving.c om/roving/images/p1x1.gif" WIDTH=1 HEIGHT=1 alt=" ">
Here's what I understand from it ... this image source is actually a JSP
that does some statistics generation after which the actual image is loaded. I tried doing this with an ASP and PHP page but I don't know what type of
code would go into the proper code to actually return an image to the
calling HTML.

In summary, I e-mail a page to my clients. Their HTML enabled mail software opens my mailout, and in the process of loading up a key image on the page, my backend PHP updates my MySQL server about this activity.

So can someone please explain to me how I can achieve this objective?


I'm a member on a photography website and to spice stuff up, I made a php
script that I could call that would output a random file. Here's the code...

<?php
header("Content-type: image/jpeg");

$num = rand(1,3);
$image = imagecreatefrom jpeg("nikon_ava tar0".$num.".jp g");
imagejpeg($imag e);
imagedestroy($i mage);
?>

Within the folder, I have three JPEG images named...
nikon_avatar01. jpg

nikon_avatar02. jpg

nikon_avatar03. jpg

Basic, but easily expandable to check the referer and give an alternate
image if it's requested outside of the website such as a link from another
website.

-William
Jul 17 '05 #3
In article <LZ************ *****@newssvr24 .news.prodigy.c om>, OneSolution wrote:
<IMG
SRC="http://rs6.net/on.jsp?t=101127 4772185.1011242 055951.10112002 90023.5850&
o=http://ccprod.roving.c om/roving/images/p1x1.gif" WIDTH=1 HEIGHT=1 alt=" ">

Here's what I understand from it ... this image source is actually a JSP
that does some statistics generation after which the actual image is loaded.
I tried doing this with an ASP and PHP page but I don't know what type of
code would go into the proper code to actually return an image to the
calling HTML.
I see most people generating some an image in that code.
Instead of doing that my script does the statistics, and then redirects
to the actual image.

Fe:
<?php //banner.php
doOtherStuff($_ GET['client_id']); // do bookkeeping for this client
$addr = $_SERVER['REMOTE_ADDRESS '];
$country = findCountry($ad dr); // using geoip or the like
$url = findURL($countr y); // lookup the url for the given country in our db
header('Locatio n: $url');
?>
In summary, I e-mail a page to my clients. Their HTML enabled mail software
opens my mailout, and in the process of loading up a key image on the page,
my backend PHP updates my MySQL server about this activity.


I'm happy that every decent mail/news client has the ability to disable
the loading of external images in an e-mail or usenet posting.
--
http://home.mysth.be/~timvw
Jul 17 '05 #4
"William Holroyd" <w.*******@vers ity-cobalt.com> wrote in news:c7s289$d96 $1
@cnn.cns.ksu.ed u:
imagejpeg($imag e);
imagedestroy($i mage);


I never heard of these functions, being new to PHP, but I did some googling
and an example of its (imagecreatefro mjpeg) use reads like it will use a
larger image as a reference, and then make a temp smaller copy of it on the
server (say a thumbnail) for download... intead of having to manually
create and store thumbnails. Does that sound about right?
Jul 17 '05 #5
The use of imagecreatefrom jpeg() simply allows you to load an existing JPEG
image file into memory to manipulate. You could also use the ...frompng,
....fromgif, or ...fromwbmp to load the respective file formats as well. It
just allows php to know what file type it is you are loading and how to
organize it in the buffer (thats the way it was explained to me). The
following calls imagejpeg(), ...gif(), ...png(), ...wbmp() simply take the
image in the buffer and "compile" it into a data structure for that image
format. And then finally imagedestroy() dumps the image data in the buffer
to free up memory.

Just remember to output the correct header or you might get a funky image.

You may also use the exif functions with a switch statement to discover what
format it is and use the appropriate image functions.

<?

switch (exif_imagetype ($file)) {
case IMAGETYPE_GIF:
$image_type = IMG_GIF;
break;
case IMAGETYPE_JPEG:
$image_type = IMG_JPG;
break;
case IMAGETYPE_PNG:
$image_type = IMG_PNG;
break;
case IMAGETYPE_WBMP:
$image_type = IMG_WBMP;
break;
default:
$image_type = 0;
break;
}

?>

-William

"Theo" <in*****@noemai l.com> wrote in message
news:Xn******** *************** **@216.168.3.44 ...
"William Holroyd" <w.*******@vers ity-cobalt.com> wrote in news:c7s289$d96 $1 @cnn.cns.ksu.ed u:
imagejpeg($imag e);
imagedestroy($i mage);
I never heard of these functions, being new to PHP, but I did some

googling and an example of its (imagecreatefro mjpeg) use reads like it will use a
larger image as a reference, and then make a temp smaller copy of it on the server (say a thumbnail) for download... intead of having to manually
create and store thumbnails. Does that sound about right?

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1518
by: Michael Huhn | last post by:
I have a web page default.aspx and a dynamic image image.aspx. Image gets parameters via querystring and outputs a gif. Using JavaScript I reload the image with changed parameters quite often. Sometimes it happens that the image does not appear (red cross instead) or that ie keeps loading for minutes. Opening that image in another browser gives me a "403.9: too many connections". Does iis create a new connection on every reload of that...
9
4493
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the "Let Users Add Functionality to Your .NET Applications with Macros and Plug-Ins" article at MSDN for the dynamic loading of DLLs http://msdn.microsoft.com/msdnmag/issues/03/10/Plug-Ins/default.aspx
2
1096
by: Ken Varn | last post by:
I have an ASP.NET web page that displays about 16 dynamic images using an HttpModule handler tied into16 Image controls. When the browser tries to display each image, it attempts to display all of them at the same time which causes IIS to fail on some of the requests because there are too many sessions. Is there anyway that I can prevent this from happening? I basically need to somehow tell the browser to wait for each image url to...
7
1505
by: Andrew Robinson | last post by:
Given HTML text (likely from SQL), is there any method that could be employed to render server and/or custom controls that are contained inside of that text? I would be loading content from a database and would like to 'expand' the server controls. Possibly even recursively. Hope this makes sense, but I am guessing the answer is no. If this is something that can't be done, I am looking at creating my own markup tags and searching for...
1
1810
by: Robert McLay | last post by:
I have been trying to build python on Cray X1. As far as I can tell it does not support dynamic loading. So the question is: How to build 2.4 without dynamic loading? That is: can I build 2.4 where all the extensions are archived in libpython2.4.a as a static library? Building on the Cray X1 is slow, so I have been trying to also build it under Linux without dynamic loading since it
3
6693
by: Joe Cox | last post by:
I am having a problem with style properties for dynamic images in Mac OS X Safari. By dymanic images, I mean images allocated with the javascript 'new Image()' call. With static images (created with the html <img> tag), I can make the image visible or not, i.e. '<img style="visibility='hidden'" src='xxxx'/>'. But if I create the image dynamically with javascript: new Image() then try to modify the style, Safari chokes, and the Debug...
9
2986
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I got the core of the javascript from here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm I noticed in the demo that sometimes the content takes a long
1
3650
anfetienne
by: anfetienne | last post by:
i have this code below that i made....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger image. my problem is i have captions to go with it and when i try to load the captions nothing happens or can be seen to be happening. i dont know where i am going wrong as i have no output or compiled errors var locVar = new Array();...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.