Jump to content

merylvingien

Members
  • Content Count

    267
  • Joined

  • Last visited

Community Reputation

0 Neutral

About merylvingien

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. Thanks for the replies, but i have fixed the getimage.php file and it works ok now. For anyone else that might run into this, the fix was change header("Content-Type: image/jpeg"); echo $row['image']; to $info = getimagesize($image); header('Content-Type: '.$info['mime']); echo file_get_contents($image); fastsol: Most of the original images are fairly big. Why resize a massive image that might be being downloaded on a phone via a mobile connection? Much better and quicker to serve a smaller, correct size image in the first place. Just my opinion. Anyway, thanks for the replies.
  2. Hi Folks, having a bit of an issue here that i cannot get my head around for some reason. I am working on a site that is a rebuild of an ancient site (its been around since the late 90's) Anyway, all old pages have been put into a database along with the old img tags. These images are randomly place throughout the text in the pages. Each page is called from one php file. EG: www.mysite.com/post.php?pagename=example The new site is mobile compatible so images need to be displayed as such. I always offer up larger images for desktop devices and smaller ones for mobile. EG: <?php if($ismobile) { $imgpre= "mobimages"; } else { $imgpre= "images"; } ?> <img src="<?php echo $imgpre; ?>/someimage.png" alt="" <?php if($ismobile) {echo 'width="250" height="167"';} else {echo 'width="500" height="333"';} ?>> At the moment, all the images are stored in the database as normal image tags and i have tried altering them with str_replace or preg_replace but that int going anywhere. So i have tried this <img src="getimage.php?imageid=1" width="500" height="677" alt=""> getimage.php is this: <?php $imageid = $_GET['imageid']; $sql = mysqli_query($con, "SELECT image FROM images WHERE id=$imageid"); $row = mysqli_fetch_row($sql); mysqli_close($con); header("Content-Type: image/jpeg"); echo $row['image']; ?> However, this is not working either. Anyone have any ideas, or suggestions? Its not a problem to alter the img tags in the database or have them stored seperate along with each page text. At the moment I am at a loss.
×
×
  • 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.