Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'm creating a form which should allow a user to upload a photo (along with other form elements such as text boxes) but I'm in need of a PHP script which will allow the photo to be uploaded, and if the image does not conform to specific dimensions to be resized and then cropped (from bottom center of the image).
Can you recommend any scripts available?
A fast search gave me the following results.
If I was you I would use Jcrop with my own uploading script.
php- Edit upload file + Crop image
upload and crop image before sending it to the server
Image uploader + crop
I would like to recommend this example.
http://www.webmotionuk.co.uk/php-jquery-image-upload-and-crop/
Good luck.
Prasad.
I recommend upload.class.php. It is the best class for handling images.
You can find it here:
http://www.verot.net/php_class_upload.htm
Related
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 10 months ago.
Improve this question
I want to display a simple image gallery on a PHP webpage where the images are compressed; however, it allows for full res jpegs to be downloaded. And I'm just curious what method you would recommend for a project like this?
I'm thinking I store the full-res jpeg on my server and use server-side PHP imagecreatefromjpeg() and imagejpeg() to create a lower-res thumbnail of the image with an option to download? Or I suppose I could store lower res and high res jpegs both on the server and just echo them out but I would rather not store the lower res if possible.
Are there any other options for a project like this? And if imagejepg() is a good option, would someone direct me in how to use it?
Lower-rez images typically take much less disk space, much less, than hi-rez images. Disk space is extremely unlikely to be a limiting factor when you pre-create the smaller images.
And, resizing and decompressing on the fly in response to user requests eats server power. Store the low-rez images: think green.
For what it's worth, WordPress (40% of web servers on the net) resizes on upload and stores resized images, so that approach is proven effective.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
This post was edited and submitted for review 1 year ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
my current project involves getting all uploaded images to the same size in the end.
Furthermore I would like to hear about your approaches on how to do the image manipulation.
What I want to do:
A user uploads an image with the size of 2560x1440.
Now I want to display the image with the size of 1280x720. Well that's the easy part. Every library can scale an image down like that.
But if a user uploads an image with like 500x2000 a rescale to 1280x720 will be very ugly.
My idea was to create a blank image with the size of 1280x720 and scale the incoming image down to a heigt of 720 and make the background in gray. If you can follow me so far, the new image will now be 1280x720 but on the side it's filled gray with the original image in the center.
Would you do this the same way? Is there a library out there, that is capable of this?
Thank ahead
DaNeubi
Sounds like a reasonable approach. I'd look at ImageMagick for which there is a PHP extension. You'll need to write the logic to determine the image rescaling and background sizing.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to change image size before uploaded on server/mysql database, As its for member, so member can uploaded big images in size and i want to prevent and assign a new image size of their images.
I need it in PHP.
Thanks
Resizing an image in php without uploading first is not possible as php only runs on the server side. It can be done with js though, there are a lot of libraries that can help you out, like Jimp, Jcrop and Processing.js.
If you really want it in php than the image has to be uploaded first and than you will be able the resize the image with imagecopyresized function for example.
The php manual has an example here
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm building a iPhone Application which displays some photos. First in a UICollectionView as a thumbnail then bigger in fullscreen.
For better loading behavior I would like to load smaller images first for the thumbnail part. Now: Should I do this via PHP and resize the existing big image or should I save a second image on the server XXX_thumbnail.png and load this one?
Thanks for your tip.
Chris
Resizing an image can be quite an intensive process for the server, especially with larger images. Imagine if 1000 users hit it at the same time. You absolutely should only do this once per image, and save it for later requests. Whether you pre-render all thumbnails or not is another matter, but executing a file_exists is pretty cheap. You can just render them once, at the time they are requested. All depends how you want to access them (e.g. through a script or just the thumbnail url directly)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm generating a pdf for every page using FPDF. Its working properly. But the main problem is with the file size. Some files have a size of more than 2Mb. I want to limit the size. How can I limit the size within 300 kb? Any help would be appreciated.
Typically PDFs are large because they contain large images or because they contain large fonts.
So the solution is typically to reduce the resolution of the images and to avoid the fonts getting embedded.
If FPDF will allow you to do this then this will likely solve your problem.
If not then you will need to post-process your PDF using another library to unembed the fonts and resample the images.
ABCpdf will do this using the ReduceSize operation. No doubt other libraries will allow something similar.
I work on the ABCpdf .NET software component so my replies may feature concepts based around ABCpdf. It's just what I know. :-)
The best way is to compress pdf file is that first you generate the pdf and then use any tool to compress the pdf file. As far as my experience is concerned, there is no other way to compress pdf file.