I am struggling to create a PHP function that would take a specified
image (JPG, GIF or PNG) from a link, and resize it down to a thumbnail
so it will always fit in a 200x250 space. I am hoping not to have it
inserted or read from a database to do this function. Can it be done &
someone please help me? 4 14448
Julia Briggs wrote: I am struggling to create a PHP function that would take a specified image (JPG, GIF or PNG) from a link, and resize it down to a thumbnail so it will always fit in a 200x250 space. I am hoping not to have it inserted or read from a database to do this function. Can it be done & someone please help me?
You could simply write out a <img src="http://othersite.com/image.jpg
width="200" height="250"> tag, but this is
a) not very nice to the people whose site you deeplink too (sometimes
not even allowed/possible), and
b) it would mean for displaying only a thumbnail the full image has to
be loaded by the client.
The decent thing would be to load the pic (if allowed), resize it using
GD or Imagamagick library functions and store it on your own server.
Thus it's resized only once and you take responsibility for the
bandwidth your site incurs.
There are ways of making thumbnails without addon libs, see http://www.sitepoint.com/forums/arch...p/t-57426.html for
instance. Heed the warning: these algorithms appear to be very SLOW.
PHP manual might also help you further...
HTH
SH
I noticed that Message-ID:
<11*********************@f14g2000cwb.googlegroups. com> from Julia Briggs
contained the following: I am struggling to create a PHP function that would take a specified image (JPG, GIF or PNG) from a link, and resize it down to a thumbnail so it will always fit in a 200x250 space. I am hoping not to have it inserted or read from a database to do this function. Can it be done & someone please help me?
As SH has said, it's better to do this just once. Also bear in mind
that not all pictures will share the same aspect ratio. To maintain
this, you can either pick width or height, but not both.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Thanks Geoff & SK -- is it possible to somehow load the original image,
and store it into a 'virtual one time session blob variable' (pls
forgive me for my crude wordiness, but conceptually this is what I
imagine)... and then resize the width first, and after its resized,
then apply a second resizing for the height (so this ensures all images
no matter what will fit into a 200 x 250 space). I don't know the full
extent of what's possible with PHP... but can you work this way without
a database? All my images will be fairly small, but I'm working in a
very restrictive server space limitation, so don't want to store an
extra thumbnail image in the database if all possible.
Schraalhans Keukenmeester wrote: Julia Briggs wrote: I am struggling to create a PHP function that would take a
specified image (JPG, GIF or PNG) from a link, and resize it down to a
thumbnail so it will always fit in a 200x250 space. I am hoping not to have
it inserted or read from a database to do this function. Can it be
done & someone please help me? You could simply write out a <img src="http://othersite.com/image.jpg
width="200" height="250"> tag, but this is a) not very nice to the people whose site you deeplink too (sometimes
not even allowed/possible), and b) it would mean for displaying only a thumbnail the full image has
to be loaded by the client.
The decent thing would be to load the pic (if allowed), resize it
using GD or Imagamagick library functions and store it on your own server. Thus it's resized only once and you take responsibility for the bandwidth your site incurs.
There are ways of making thumbnails without addon libs, see http://www.sitepoint.com/forums/arch...p/t-57426.html for instance. Heed the warning: these algorithms appear to be very SLOW.
PHP manual might also help you further... HTH SH
I noticed that Message-ID:
<11*********************@c13g2000cwb.googlegroups. com> from Julia Briggs
contained the following: Thanks Geoff & SK -- is it possible to somehow load the original image, and store it into a 'virtual one time session blob variable' (pls forgive me for my crude wordiness, but conceptually this is what I imagine)... and then resize the width first, and after its resized, then apply a second resizing for the height (so this ensures all images no matter what will fit into a 200 x 250 space). I don't know the full extent of what's possible with PHP... but can you work this way without a database? All my images will be fairly small, but I'm working in a very restrictive server space limitation, so don't want to store an extra thumbnail image in the database if all possible.
Well thumbnails won't take much space and what most people do is store
filenames in databases rather than the files themselves.
But rather than resize twice, what I'd do is get the image dimensions
and then use logic to determine whether to resize on height or width.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: DH |
last post by:
I have a "file upload form" that works OK, but I have been unsuccessful
in my attempt to also resize the uploaded .JPG (if it is too wide),
over-writing the original .JPG, and then create and save...
|
by: SlasherStanley |
last post by:
BlankHi
How do you resize a jpg file. I want to open a file (c:\abc.jpg 800 x 600) and resize it as 120 x 100, I then want to save it as c:\abc_t.jpg.
Thanks
Slasher
|
by: J'son |
last post by:
Guys,
I have built an application for a client that allows people to list
their products for sale along with a photo of the product. If the photo
is too big, I currently resize it down when the...
|
by: Lad |
last post by:
Is it possible to change a picture resolution with Python?
Let's say I have a picture with a resolution of 96 dpi and I would like
to increase to 256dpi or higher.
Thank you for your reply.
LL
|
by: Robert S |
last post by:
I am writing an image viewer. I want to be able to resize the image so
that it always fits within a window of given height and width.
I've tried a couple of these from the web, but the don't...
|
by: Tim Arnold |
last post by:
Hi, I'm using the Image module to resize PNG images from 300 to 100dpi for
use in HTML pages, but I'm losing some vertical and horizontal lines in the
images (usually images of x-y plots).
...
|
by: infoseekar |
last post by:
Image Resize & Rotation
Hi
I have 2 scripts, one for Image rotation and other image resize and they both are working.
Image resize scripts load the picture and resize it and Image rotation...
|
by: Ty |
last post by:
Hello all,
I am creating a web site with Visual Stuido 2008. I am trying to use
a java script file to create a busybox for login from this page
http://blogs.crsw.com/mark/articles/642.aspx.
I...
|
by: simon2x1 |
last post by:
i have an image which width is 213 and height is 200 when
i echo the image and i resize it
echo "<img src='company/$present' width='70' height='68'/>";
the image was not as clear as when it was...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |