Jump to content

Not sure where to begin...


AV1611

Recommended Posts

I have a site that pulls forum data via sql and based on various conditions, places it on another site.

 

The site is working good, and I've been able to create filters like converting (some) bbcode back to html, etc...

 

Anyways,

 

What I want to do, and I don't know where to begin, is when the data string has something like this:

 

$str = 'blah blah blah blah <img src="somepic.png" alt=''whatever" />';

 

is I want to somehow "thumbnail" that pic before it shows up on the site.  I DON'T want to change it on the forum site...

 

Dunno if this is a GD thing or whatever...

 

I tried putting:

 

img{

    width: 200px;

    }

 

in the css, but it makes pic's that are smaller than 200px bigger, which is a problem, but it did seem to fix the ones that were bigger than 200px though...

 

Help?

 

 

Link to comment
Share on other sites

A number of options here.

  • You could stick with your styling method you used above, but improve it by checking the dimensions of the image first with getimagesize()
  • Build a scaled version of the image with the GDLib functions, I believe you can reference remote files as your source with imagecreatefromjpeg() - Check the manual for rescaling, a couple of people have posted up scripts in the comments if you can't figure it out.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.