Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
image resizing (javascript or php?)
I can see some need for having an intermediate size of an image.
I currently have thumbnails (40px square) and the originals (usually about 400px wide by varying heights)
I would like to create a middle size occasionally. A larger thumbnail, but in direct proportion to the original. So a max-height styling with CSS would not cut it.
I have looked around for some Jscript or php that might handle something like this (dynamically), but haven’t found anything yet.
Does anyone have any ideas?
Matthew
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
Re: image resizing (javascript or php?)
Take a look at <a href=“http://ca3.php.net/manual/en/function.getimagesize.php”>getimagesize()</a>. You could pretty easily rig something that takes the result and divides it by a constant.
Offline
Re: image resizing (javascript or php?)
It’s already right there in Textpattern’s core code.
Take a look at textpattern/lib/class.thumb.php
, these are the functions which are used to build the thumbnails. This module contains a method which writes a scaled image to any file. You can even specify percentages for size reductions and allow/forbid unsquare pixels, i.e. (non-)proportional scaling.
//w&
Last edited by wet (2005-12-28 19:42:25)
Offline
Re: image resizing (javascript or php?)
Wet,
I took a look at the php file, and as usual I am lost, though intrigued :)
I’m not a coder, but hope to continue learning, so, hey, feel like filling me in here? What would the application of what you are talking about look like?
Would I throw a little <code><txp:php>php code here</txp:php></code> in there?
thanks,
matthew
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
Re: image resizing (javascript or php?)
I suppose it wouldn’t be that simple as just adding a few lines of txp:php
here and there, you might have suspected this yourself as well ;-).
I think that would be a fine addition to the admin side as a plugin extending the “content > image” tab. User interface would imitate the one already present for the thumbnails, and the resulting files would be stored with an additional letter just like the “t” is appended to the thumbnail image filenames by now.
You will definitely learn a lot with that task at hand…
Offline
Re: image resizing (javascript or php?)
bq.You will definitely learn a lot with that task at hand…
Yeah, well, probably not :) I’m no where near ready to dive into that one. I’m still learning about expressions and operands and such.
I actually daydreamed the other day that it would be a great txp exercise for some plugin developers to take some would be plugin developers through an easy tutorial or a lesson on plugin dev for txp? pipe dream?
Thanks man,
I’ll save the idea for later.
Matthew
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
Pages: 1