ryanwood4 Posted October 30, 2011 Share Posted October 30, 2011 Hi, I'm not 100% sure if this is HTML, PHP or Javascript, but my best guess is PHP. When you upload an image on Facebook, it automatically gathers the data about the image, i.e. size, device used (i.e. Canon, iPhone), title and description. It then outputs this on the page. Is there anyway to do this with PHP, instead of having to type all the information out again and upload that with the photo to a database? Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/250114-uploading-image-properties-to-database/ Share on other sites More sharing options...
floridaflatlander Posted October 30, 2011 Share Posted October 30, 2011 Here's the code I use using getimagesize() // Calulate the details of the original // define width, height & type - type is stored as a # 1-gif, 2-jpg, 3-png list($width,$height,$type) = getimagesize($original); // getimagesize returns 4 elements, list takes the first 3 // calculate the scaling ratio if ($width <= MAX_WIDTH && $height <= MAX_HEIGHT) { $ratio = 1; } elseif ($width > $height) { $ratio = MAX_WIDTH/$width; } else { $ratio = MAX_HEIGHT/$height; } Quote Link to comment https://forums.phpfreaks.com/topic/250114-uploading-image-properties-to-database/#findComment-1283459 Share on other sites More sharing options...
ryanwood4 Posted October 30, 2011 Author Share Posted October 30, 2011 Thanks. I'll give that a go. However, that might work out the size, but how can I access and output all the data stored in the images properties, i.e. Title, description, tags, device make, model etc??? Quote Link to comment https://forums.phpfreaks.com/topic/250114-uploading-image-properties-to-database/#findComment-1283539 Share on other sites More sharing options...
ryanwood4 Posted November 1, 2011 Author Share Posted November 1, 2011 Does anyone know of any scripts to output the meta data from an image? I've had a look around and I can't see a simple script which displays basic image meta data, such as title, tags, camera used, etc. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/250114-uploading-image-properties-to-database/#findComment-1284099 Share on other sites More sharing options...
xtopolis Posted November 1, 2011 Share Posted November 1, 2011 http://php.net/manual/en/function.exif-read-data.php ? Quote Link to comment https://forums.phpfreaks.com/topic/250114-uploading-image-properties-to-database/#findComment-1284106 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.