mike_bike_kite Posted August 20, 2015 Share Posted August 20, 2015 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. Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted August 20, 2015 Share Posted August 20, 2015 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). Quote Link to comment Share on other sites More sharing options...
mike_bike_kite Posted August 20, 2015 Author Share Posted August 20, 2015 but is it safe creating image files and placing them there? Obviously I'll check to see if they are images and that the file contains no special char but but it seemed a bit risky placing them in the doc root. Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted August 20, 2015 Share Posted August 20, 2015 With images you got not other choice. In order for a browser to display an image it must be stored in a public accessible folder. To validate whether the image you have is valid use getimagesize. Quote Link to comment Share on other sites More sharing options...
mike_bike_kite Posted August 20, 2015 Author Share Posted August 20, 2015 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.