Hi Guys, I am currenlty working on something that will require me to receive High Res images. I am not sure how to provide the upload process. Couple of things:
1- Would I be able to validate if the image is 300 dpi?
2- How do I receive these images, through regular file upload html element or provide a different solution?
I look forward to your suggestions.
How are you going to receive these images from a website?
Not sure if I understand what you are asking
I’ve not done this before, but I know it can be done, initially with a html form with a
<input>. But then you need some back-end processing script to handle what happens after they submit.
I’m not sure, but probably. PHP has some image functions, so may be able to read the metadata in the file. But it’s not something I’ve looked deeply into yet, though it’s on my “to learn” list.
It’s not the most straightforward process to upload a file to your server but there is a tutorial here which might help.
Yes, the concerns good be better described.
My take is that “from website” should be “to website” and that the conerns are
- how to determine and ensure DPI
- how can the image files be transferred
Unless the files are for download and printing remotely, the term should probably be PPI (pixels per inch) instead of DPI (dots per inch)
In any case, I think the information might be able to be gleaned from the EXIF (i.e. resolution values) if the image has that.
IMHO using input type file would be the better way though allowing FTP upload could work too as long as adequate security measures are in place. (same goes for any upload method, just that FTP is trickier to get right)
A possible concern might be dealing with lossy images depending on how crucial maintaining the image quality is.
PHP GD certainly allows you to read the exif information from an image, and thus the XResolution and YResolution (dpi) values. See exif_read_data($jpgfile) for that.
But I fear you may have an off definition of “high resolution” if you are expecting the jpg “dpi” to have anything to do with it. The dpi values in a jpg are only used in printing, and specify how many image pixels to map into one inch of print paper. It says nothing about how large the overall image is. I.e. an image 1/2" square can be made with a 150x150px image set to 300dpi. The same image can be printed 15" square by simply setting the dpi value to “10”. In both cases, it’s exactly the same image, with the same resolution (150x150).
@csosa I meant that I need the user to upload images either through a form or some other way (not sure), as long as I am able to receive the images from a web interface.
Good point, the two are often confused or thought of as interchangeable. To clarify, DPI refers to the density of a halftone screen in printing. PPI is the resolution in pixels, in relation to the real world dimensions of the picture. Both units of resolution are related to the printed image, and have little relevance to on-screen imagery. If you have very specific requirements, you need to be clear on this.
In that case, the tutorial I linked to should be just what you need.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.