Jump to content

PHP and local images


mike_bike_kite

Recommended Posts

I'm writing a tool to take a mysql database and then display it on the web.

I quite like designing and writing languages so it doesn't bother me too much if such a tool already exists.

My problem is when displaying a front page showing a selection of images from items in the database - it's just too slow if it's pulling images from various external sites via a url.

I figured why not have a button that will take the existing image URL and then resize it (make it smaller), try to make the background transparent and then store the image file locally.

I can do most of this (the transparency thing is a bit hit and miss) but I'm not sure where to store the images so I can display them later.

I can store them in /var/tmp/app_name/images/ but then I can't display it.

I'm probably just being stupid but is there a proper way of doing this?

 

Also, I'm using GD for the images but I seem to have to use 3 different methods depending on whether the image is a png, gif or jpg - is there a single method that might work?

 

Many thanks for your time

 

Mike

 

PS here's an example database on chromebooks.

 

Link to comment
Share on other sites

 

I can do most of this (the transparency thing is a bit hit and miss) but I'm not sure where to store the images so I can display them later.

Any where provided the folder you store the images in is publicly accessible by your http server. For example your websites document root folder (the folder where you upload the files for your website).

Link to comment
Share on other sites

OK fine - many thanks.

 

PS Not sure if this is typical but it took about 10 attempts to join the forum - either the picture code I was entering was continually wrong or, if I ever did get it right, then the random question field had cleared meaning I had to enter all over again. Of course on each iteration it kept setting the tick box that says please send me spam. This was was actually quite frustrating. It might be worth altering things so the random question doesn't change and the old answer stays plus the spam checkbox stays unchecked if the user has unchecked it. 

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.