473,511 Members | 16,358 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic images

Ok, I just wrote some functions last night for a few people, I posted them
up for whom ever wants it (free)

http://www.gzentools.com/gzimg.php

It is simple a way to spit out thumbs, or resized images, and to cache the
image so it doesnt have to be rebuilt.

Nothing fancy, but it could help a few people out.

--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #1
8 2790
Nice. I think we make better use of the client cache though, by redirecting
to the generated image. As it is, the browser has to refetch the image
everytime.

Uzytkownik "CountScubula" <me@scantek.hotmail.com> napisal w wiadomosci
news:5F******************@newssvr25.news.prodigy.c om...
Ok, I just wrote some functions last night for a few people, I posted them
up for whom ever wants it (free)

http://www.gzentools.com/gzimg.php

It is simple a way to spit out thumbs, or resized images, and to cache the
image so it doesnt have to be rebuilt.

Nothing fancy, but it could help a few people out.

--
Mike Bradley
http://www.gzentools.com -- free online php tools

Jul 17 '05 #2
"Chung Leong" <ch***********@hotmail.com> wrote in message
news:iI********************@comcast.com...
Nice. I think we make better use of the client cache though, by redirecting to the generated image. As it is, the browser has to refetch the image
everytime.


Thank you,

Hmm, sounds interesting, you mean have a cache dir that is in the web server
view, and do a Location: bla.... to point to the image?

Hmm I will have to play and see, becouse as it is, if there is any change
int he source image, there is a new image generated.

also, I just added a few more functions:

title - add a caption
pan - show part of image
zoom - show a zoomed from middle portion
tile - tile the image

--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #3
Regarding this well-known quote, often attributed to CountScubula's famous
"Sat, 24 Jan 2004 01:48:37 GMT" speech:
"Chung Leong" <ch***********@hotmail.com> wrote in message
news:iI********************@comcast.com...
Nice. I think we make better use of the client cache though, by

redirecting
to the generated image. As it is, the browser has to refetch the image
everytime.


Thank you,

Hmm, sounds interesting, you mean have a cache dir that is in the web server
view, and do a Location: bla.... to point to the image?

Hmm I will have to play and see, becouse as it is, if there is any change
int he source image, there is a new image generated.

also, I just added a few more functions:

title - add a caption
pan - show part of image
zoom - show a zoomed from middle portion
tile - tile the image


Just title the cached image uniquely --

something like:
[PATH-HASH]_[MOD-DATE].ext

where [PATH-HASH] is the full original path, run through something (md5 or
a search-replace) to purge evil chars, and [MOD-DATE] is the file's
last-modified date. When the code is run, do something like:

1.) Get all filenames containing [PATH-HASH] in the cache directory
2.) Is the latest [MOD-DATE] the same as the real file's modified-stamp?

3. Yes) Do not recreate the thumbnail. Redirect to the cached version.

3. No) Delete (unlink) all files with [PATH-HASH]_*
4. No) Create a new thumbnail, and redirect to it.

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #4
"FLEB" <so*********@mmers.and.evil.ones.will.bow-down-to.us> wrote in
message news:1p******************************@40tude.net.. .
Regarding this well-known quote, often attributed to CountScubula's famous
"Sat, 24 Jan 2004 01:48:37 GMT" speech:

1.) Get all filenames containing [PATH-HASH] in the cache directory
2.) Is the latest [MOD-DATE] the same as the real file's modified-stamp?

3. Yes) Do not recreate the thumbnail. Redirect to the cached version.

3. No) Delete (unlink) all files with [PATH-HASH]_*
4. No) Create a new thumbnail, and redirect to it.

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com

the images are already cached and uniq named, Leong was talking about
redirecting rather than readfile. look at the script and you will
understand.

--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #5
Yup, let Apache send the image, since it's pretty good at dealing with the
nitty gritty of HTTP transport (caching, validation, partial retrieval,
etc.). Also saves a trip into the PHP output buffer.

I guess you can implement it in a different set of functions, so that you
would retain the ability to send the file via PHP, in cases where you want
to control access to the images.

One more suggestion: before calling readfile(), do a session_write_close()
to remove the session lock if a session is opened.

Uzytkownik "CountScubula" <me@scantek.hotmail.com> napisal w wiadomosci
news:V9******************@newssvr25.news.prodigy.c om...
"Chung Leong" <ch***********@hotmail.com> wrote in message
news:iI********************@comcast.com...
Hmm, sounds interesting, you mean have a cache dir that is in the web server view, and do a Location: bla.... to point to the image?

Hmm I will have to play and see, becouse as it is, if there is any change
int he source image, there is a new image generated.

also, I just added a few more functions:

title - add a caption
pan - show part of image
zoom - show a zoomed from middle portion
tile - tile the image

--
Mike Bradley
http://www.gzentools.com -- free online php tools

Jul 17 '05 #6
"Chung Leong" <ch***********@hotmail.com> wrote in message
news:7o********************@comcast.com...
Yup, let Apache send the image, since it's pretty good at dealing with the
nitty gritty of HTTP transport (caching, validation, partial retrieval,
etc.). Also saves a trip into the PHP output buffer.

Working on it as we converse, will be in ver 1.5, I added a few things check
it out.
One more suggestion: before calling readfile(), do a session_write_close()
to remove the session lock if a session is opened.


Please explain, can you elaborate?

--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #7
CountScubula wrote:
"Chung Leong" <ch***********@hotmail.com> wrote in message
news:7o********************@comcast.com...
Yup, let Apache send the image, since it's pretty good at dealing with the
nitty gritty of HTTP transport (caching, validation, partial retrieval,
etc.). Also saves a trip into the PHP output buffer.

Working on it as we converse, will be in ver 1.5, I added a few things check
it out.

One more suggestion: before calling readfile(), do a session_write_close()
to remove the session lock if a session is opened.

Please explain, can you elaborate?

--
Mike Bradley
http://www.gzentools.com -- free online php tools


I dig this:
gzImageSetCacheDir(dir[,url]);
That's hot.

- Dan
http://www.dantripp.com/
Jul 17 '05 #8
Two PHP scripts cannot access the same session simultaneously. If the
browser tries to download two images concurrently, and a session is opened
(say, if auto session is used), one of them will stall until the other is
done, unless you release the session with a call to session_write_close().

Uzytkownik "CountScubula" <me@scantek.hotmail.com> napisal w wiadomosci
news:LA*****************@newssvr29.news.prodigy.co m...
"Chung Leong" <ch***********@hotmail.com> wrote in message
news:7o********************@comcast.com...
Yup, let Apache send the image, since it's pretty good at dealing with the nitty gritty of HTTP transport (caching, validation, partial retrieval,
etc.). Also saves a trip into the PHP output buffer.

Working on it as we converse, will be in ver 1.5, I added a few things

check it out.
One more suggestion: before calling readfile(), do a session_write_close() to remove the session lock if a session is opened.


Please explain, can you elaborate?

--
Mike Bradley
http://www.gzentools.com -- free online php tools

Jul 17 '05 #9

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

Similar topics

3
3128
by: Perttu Pulkkinen | last post by:
I use database to store images. So img-tags are like <img src="viewer.php?img_id=100"> Can I use javascript/php-combination to preload images of whole site after first page is loaded? Or does...
5
2341
by: K | last post by:
I have found a script online that I want to use (I am new to PHP). It creates dynamic images based on the text that you pass it. However, no matter how I try, I can't get anything other than a...
5
3370
by: Travis Pupkin | last post by:
Hey, I've done a number of product catalogs/galleries with one or two category levels (Category > Subcategory). The straightforward way to do this, of course, is to use database fields for...
3
2694
by: JOSEPHINE ALVAREZ | last post by:
I have this code that I want to use to do a rollover. However, because the company I am doing it for is continually changing the text, I want to be able to use dynamic text to change the text on...
3
1341
by: Ken Varn | last post by:
I have an ASP.NET page that draws over 32 dynamic images using an HttpModule object through the <IMG> tag. Since IIS under Win2K Pro has a limit of 10 connections, some of the images do not get...
3
13725
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
1
2696
by: richardgroen | last post by:
Hi all, I got one brainteaser (well...for me). I have a database with, lets say 100 images, these images are 'dynamic' e.g. it can be 100 but also 151 images. My question is: How can i...
0
1860
sumaiya
by: sumaiya | last post by:
I have bought a flash template and hve made it dynamic ie it has dynamic text but now i want to have dynamic images as well. The code that I have for the same is working but whn i use it in the...
0
1108
by: javasachin | last post by:
Dear Friends, I have a requirement like this: In my JSP Page, I want to display some dynamic Arrow Images. While clicking on each of these Arrow Images, I want them to expand and create some...
3
3563
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi! This discussion may help other programmers get a better idea of how to save uploaded images through a website. Why? Well currently, I save 3 versions of every uploaded image on my own...
0
7242
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,...
0
7138
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...
0
5662
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
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 ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
446
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...

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.