0

I maintain a site that will get a new layout, with a new width for the content area (currently 390px, say 500px for the new width). Many images (but not all) are sized to the current width (some are smaller, some are larger but should they should not be). How do I prepare the resize to the new width of 500px? Not all images are included as attachments (yet).

I would like:

  • All images that are 390px and have an original of 500px or larger, should resize to 500px
  • An overview of all images that could not be resized because the original is not available or smaller than 500px
  • An overview of all images that are larger than 500px, so I can decide on them myself
  • All OEmbeds that are 390px should resize to 500px
  • An overview of all "old-style embeds" (probably all Flash objects) so I can replace them by OEmbeds of the correct size.

1 Answer 1

1

You are almost certainly going to need to write a set of scripts to accomplish what you are looking to do. The first step would be get all of them imported as attachments.

You've got a great set of specs for those scripts so the next step is to write each of them (actually, each of your criteria look like they could be a different question here on the site.)

Here's the list of image handling functions in WordPress; you'll need them to be able to write these scripts. Check out the attachment and the low-level image handling functions.

P.S. If you want to over the next week or two add each of your criteria as it's own question complete with a well written title and enough background in the text of the question then I (and others) can answer each question with a specific code snippet and we will have created a great reference for each of those questions that can later be more easily found via Google. And you can even link this question to those new questions in an update.

2
  • Indeed, the general problem could be broken apart in sub-problems. I didn't plan to have all these requirements, but they came naturally when I was writing the question. Of course, I was hoping others had solved this problem before, so they had tips (or code!) to help me. But it will be an interesting journey!
    – Jan Fabry
    Commented Sep 5, 2010 at 20:16
  • @Jan: Yes, very familiar with the "I didn't realize until I wrote it all down" syndrome. Happens constantly to me! :) FYI when I look at your question above I feel overwhelmed so I don't write code to answer it. If you asked a separate question for each (yes, recognizing the need after the fact; both high level and low level questions are good) then I (and others) could look at each question and think the scope of answering is doable in a reasonable amount of time. So I'm suggesting a questioner's strategy for getting better results to ask smaller more focused questions. FWIW. Commented Sep 5, 2010 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.