I have been attempting to use a mashup of jquery plugins found on this website. as far as i can tell this is a pretty good peice of code, just have a couple of issues.
my main issue is that if i attempt to upload a file that is larger than the max file size in firefox it sends a javascript alert saying "error" which it is supposed to do but then crashes firefox and i have to physically end the process.
my next issue is that when you do upload an image and specify the crop target it doesnt actually seem to crop it rather just resize the the image to fit the samll region.
I would happily plough through the code myself but i know very little about javascript and next to nothing on jQuery, i do however know a fair bit about php so that side of things shouldnt be too bad.
hope someone can help,
Nate.
You can't resize the image in Javascript - i imagine all it does is change the image tag. You need to send the resize coordinates/height/width to your backend and then resize it there.
Related
Hi I've been working with the iTunes API and what I've done is saved the data that's returned from the search into the database. I'm saving the iTunes image URL to my database and I'm wondering what would be the best method to crop the image from the URL with PHP, or is it better to crop the image with jQuery before I display the images on the site? Thanks in advance for you advice!
You're going to want to crop images server-side, probably. Cropping client side means the client is going to have to load the whole image, and that will slow down page loads (potentially a lot, depending on how big the images are).
Cropping server-side means that you'll have to save the cropped images to your server and serve them from there. This is more of a pain than just doing the cropping client-side, but it will probably be better for your users in the end.
Since you're using PHP, you want ImageMagick.
Full step-by-step tutorial to crop image using jQuery & php (included live demo)
http://www.script-tutorials.com/image-crop-plugin-using-jcrop-jquery/
It is best to crop and store the cropped versions on the server, that way the images load faster and you save a lot of bandwidth.
I'm trying to make a simple app which gives a user a standard background/template image onto which they can place their logo/brand/whatever. I've had a look at a few jQuery plugins which allows the user to upload and crop an image, and most of them seem to work by posting the x and y coords, and the width and height, to the server.
I'm able to then use imagecopyresampled() to merge the image with the background image, but (a) the user's image seems to end up really skewed, even when I hard-code dimensions that I know should work, and (b) I need to position the uploaded image pretty much dead-center -- what's the best way to achieve this?
Any help? This is my first time using GD. I'll add my own code if required, but I'm messing with the different GD functions, so I've butchered the one I had before. Will reproduce it.
Thanks
I am working on a site at the moment, that requires the admins of the site to be able to upload pretty much any size of image, I then need to find a way to get the image down to the size required for the front end of the end the site, all this needs to be done without know what size of image the user is uploading, but the image always needs to scale to 209x293 without looking awful.
Is this even possible?
You should argue with your client, to forget that rule(accept ANY image), and accept rather, only images in that proportion, or better, you can use a tool to crop the image, forcing the user to crop an image in your needed resolution.
Jcrop is a library in Jquery which can help you a lot if you want to create that cropping feature.
Don't know your precise requirements, but since you tagged it with CodeIgniter, you can check out the Image Manipulation Class which has everything you need to do the job.
Not knowing the size of images before uploading is, you know, quite a common problem...Just be careful of the MAX SIZE, which is set in your php.ini.
You might find useful also the page on file uploading right in php's manual.
I am using this Image Upload and Cropping with PHP and Jquery: 9lessons.info Maybe someone can give me please PHP script or link to script that allows me upload image from URL?
I've found that re-sizing images using GD can be buggy, especially when you're dealing with transparency. It could also just be that your script bugs out after it's created the image but before it's copied any data into it.
Go over it step-by-step and see when the image turns black.
My iPhone application sends a picture to my PHP file. I don't know why the picture are always landscape (even though they were taken portrait). When I receive the image in my PHP I would like to rotate it, if it's portrait; I already send hopefully in the POST request enough information to check if it's portrait or landscape, but I cannot rotate the image properly.
I've found the function imagerotate() from php.net but it has some strange behavior with the background which I believe it's really dumb, since I just want to rotate the image and not having some new background to deal with.
Does anybody of you know how can I do this in a clever way?
Thanks,
Masiar