473,563 Members | 2,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic thumbnailing ?

Need recomendation for script that would dynamicly create thumbnails from
pictures in certain directory, and automaticly genreate link to original
pictures...

Tuts are also welcom...

TNX.

------
www.podvodni-svijet.com

"Half-brother in blood,
full brother in heart will I be.
Thou shalt lead and I will follow.
May no new grief divide us."

Valar morghulis!
--
Remove all FAKEs when replying to mail !

Jul 17 '05 #1
4 1469
look for some php photo-album software and review their source-code. I
worked it out by reading the php manual (image functions).

here's a function I wrote some time ago (for a photo album program of my
own). It tries to use a function called imageCopyResamp led() but falls
back to imageCopyResize d(). The newer function imageCopyResamp led()
gives better quality but not all version of GD PHP modules have it.

You will have to modify this function as it was designed for my app. The
main param you are interested in is $intSize which represents the
maximum length of the longest side you want the thumbnail to be.

function createThumbnail ($id,$idSrcImg, $intSize) {

$uriSrcDir = "../albums".$id."/";
$uriSrcImg = $uriSrcDir.$idS rcImg;
$uriThmImg = $uriSrcDir."_th umbs/".$idSrcImg ;

$imgSrc=imagecr eatefromjpeg($u riSrcImg);

$intSrcH = ImageSY($imgSrc );
$intSrcW = ImageSX($imgSrc );
if($intSrcH == $intSrcW) {
$intHeight = $intWidth = $intSize;
}
elseif($intSrcH > $intSrcW) {
$intHeight = $intSize;
$intWidth = ceil(($intSrcW/$intSrcH) * $intSize);
}
else {
$intWidth = $intSize;
$intHeight = ceil(($intSrcH/$intSrcW) * $intSize);
}

$imgThm=imagecr eate($intWidth, $intHeight);

if(
!@imageCopyResa mpled(
$imgThm,
$imgSrc,
0,
0,
0,
0,
$intWidth,
$intHeight,
$intSrcW,
$intSrcH
)
) {
imageCopyResize d(
$imgThm,
$imgSrc,
0,
0,
0,
0,
$intWidth,
$intHeight,
$intSrcW,
$intSrcH
);
}
Jul 17 '05 #2
re: revious example code:
forgot to include a closing brace in all the excitement...

Jul 17 '05 #3
Tnx. I will take a look at your code and refer to manual, im sure I'l manage
something..

Cheers....

------
www.podvodni-svijet.com

"Half-brother in blood,
full brother in heart will I be.
Thou shalt lead and I will follow.
May no new grief divide us."

Valar morghulis!
--
Remove all FAKEs when replying to mail !

Terence natipkase:
re: revious example code:
forgot to include a closing brace in all the excitement...

Jul 17 '05 #4
http://www.php.net/image

but i found it easier to use ImageMagick's convert tool, called via an
exec() in my thumbnailing script.
..: DeVa :. wrote:
Need recomendation for script that would dynamicly create thumbnails from
pictures in certain directory, and automaticly genreate link to original
pictures...

Tuts are also welcom...

TNX.

------
www.podvodni-svijet.com

"Half-brother in blood,
full brother in heart will I be.
Thou shalt lead and I will follow.
May no new grief divide us."

Valar morghulis!
--
Remove all FAKEs when replying to mail !


Jul 17 '05 #5

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

Similar topics

0
1877
by: Roel Wuyts | last post by:
CALL FOR CONTRIBUTIONS International Workshop on Revival of Dynamic Languages http://pico.vub.ac.be/~wdmeuter/RDL04/index.html (at OOPSLA2004, Vancouver, British Columbia, Canada, October 24-28, 200) Organization committee: Roel Wuyts (primary contact - roel.wuyts@ulb.ac.be), Gilad Bracha, Wolfgang De Meuter, Stéphane Ducasse and Oscar...
6
2968
by: Materialised | last post by:
Hi Everyone, I apologise if this is covered in the FAQ, I did look, but nothing actually stood out to me as being relative to my subject. I want to create a 2 dimensional array, a 'array of strings'. I already know that no individual string will be longer than 50 characters. I just don't know before run time how many elements of the array...
3
1312
by: Stephen Gennard | last post by:
Hello, I having a problem dynamically invoking a static method that takes a reference to a SByte*. If I do it directly it works just fine. Anyone any ideas why? I have include a example below... --
3
2249
by: rangermccoy | last post by:
Hello there, What are the best php/c libraries for handling media including images, video, and music? I would like to manipulate media dfiles, including watermarking, thumbnailing, truncating, etc. I know there's the GD llibrary for images.
7
3377
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always either AND or OR but never mixed together. We can use Northwind database for my question, it is very similar to the structure of the problem on the...
0
2060
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab, System and Software Engineering Lab), ULB (deComp) and the Belgian Association for Dynamic Languages (BADL) are very pleased to invite you to a whole...
3
1149
by: philleep | last post by:
Hi, Someone told me that you can do auto thumbnailing in php. How? cheer, Philleep
5
2576
by: bearophileHUGS | last post by:
I often use Python to write small programs, in the range of 50-500 lines of code. For example to process some bioinformatics data, perform some data munging, to apply a randomized optimization algorithm to solve a certain messy problem, and many different things. For that I often use several general modules that I have written, like...
0
7664
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...
0
7583
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...
1
7638
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...
0
7948
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...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2082
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
1
1198
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
923
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...

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.