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
https://forums.phpfreaks.com/topic/128033-not-sure-where-to-begin/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.