Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-02-12 09:57:50

stef25
Member
Registered: 2005-12-26
Posts: 88

Batch resize images

Ive been experimenting with this for a while and its not my first post on the topic. basically i have about 400 imgs in the db that i want to batch resize so they fit in an area of 250px X 250px. Fireworks can run this batch. I tested with one image and when I upload it back to the server, it overwriters the old, larger version.

Problem is that in the db, the old, larger dimensions are still there and they are generated as the width x height attributes of the img tag so the image still displays in the old dimensions. Is there any way to make txp “re-read” the actual size of its images in a batch? Im guessing this is highly unlikely so the only solution would be to

- re-upload all my images: cant do that since id have to change the img id’s in all my articles
- edit the width x height info in the db manually: that would take weeks

can anyone think of a solution?


I need someone to protect me from all the measures they take in order to protect me

Offline

#2 2007-02-12 12:08:54

TNT
Member
From: Rotterdam, Netherlands
Registered: 2006-01-06
Posts: 256
Website

Re: Batch resize images

What if you force the dimensions of 250px by 250px through your CSS-file?

img { width: 250px; height: 250px; }


Prrrrrrrr

Offline

#3 2007-02-12 13:14:56

stef25
Member
Registered: 2005-12-26
Posts: 88

Re: Batch resize images

well that would skew the image. the batch in fireworks is “fit to area”, meaning it reduces the largest side of the image to 250 and the other side to a value less than that, but without skewing. so a 500 × 400 img would be resized to 250 × 200.

i wish css could do width: 50%; on image dimensions!


I need someone to protect me from all the measures they take in order to protect me

Offline

#4 2007-02-12 20:05:47

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: Batch resize images

(After making sure, that the batch resizing command of your Graphics program doesn’t alter the file names)
If all the images are supposed to get the same size, using either phpmyadmin or Rob Sables Data Base Manager, you can do this:

UPDATE txp_image SET h = '250',w ='250'

(In case, it’s only a specific category, you want to have a WHERE clause there as well)

(Use at your own risk)

regards, marios

Last edited by marios (2007-02-12 20:08:40)


⌃ ⇧ < ⌃ ⇧ >

Offline

#5 2007-02-12 20:09:47

stef25
Member
Registered: 2005-12-26
Posts: 88

Re: Batch resize images

marios – this sets all dimensions to 250 * 250 right? thats not what im doing, im just making the images fit in an area of 250*250, meaning only one side of the image will be 250 and the other one will be smaller


I need someone to protect me from all the measures they take in order to protect me

Offline

#6 2007-02-12 20:28:41

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: Batch resize images

That’s right: the previous thing would distort the image if depending of what your images are.
( If the aspect ratio was already 1:1, then this would work, otherwise: fingers crossed)

The only thing I could think of is ebl_batchupload, but this then doesn’t solve the img ID problem AFAIK

This is really a point, where you hit some of the major TXP weaknesses in terms of Image handling.

The question is, do all your images have the same aspect ratio ?
If so, than two db queries could still be the solution, since the only thing that’s required is to figure out, which images are landscape and which are portrait.

regards, marios

Last edited by marios (2007-02-12 20:41:42)


⌃ ⇧ < ⌃ ⇧ >

Offline

Board footer

Powered by FluxBB