How do I create thumbnail form original size (any size) to 50 x 50 (fixed size) link text
when add images to lightbox all images in any size will resize to 50 x 50 dimention how to implement that with codeigniter image class ;
imagine I have image with 600x320 dimensions when i re size it with maintain_ratio "on" it's gave me 50x27 dimensions when i re size it to 50x50 . anyway if I turn maintain_ration "off" it's resized nicely to 50x50 but output is deformed
I'm not exactly sure what you are asking. Do you want to resize an image to 50x50 or do you want to create a lightbox effect. To resize simply follow the instructions in the user guide. They're very straightforward: http://codeigniter.com/user_guide/libraries/image_lib.html
If you want to create a lightbox then you will need to use JavaScript not codeigniter. There are loads out there to choose from for different js frameworks if you don't want to build your own.
Hope that helps.
Related
I built this site via Google Web Designer (ZippyDriver.com) and want it to scale to my viewport but haven't figured out how to do it. I don't want a responsive site — just want it to stretch to the screen if possible. Any ideas???
Have you tried to change all your elements size to % instead of px dimensions?
You can achieve this by selecting any of your elements, lets say an IMG, then in its Properties -> Size and Position be sure it shows the IMG dimensions in % not in px.
After that, try resizing the viewport and see if it works.
Here's my current layout:
The layout above works fine pre iphone6 but once the view is set to iphone6+ then you get:
FYI Those images look like the same size because of how they are displayed in sof. Click the image itself and you'll the actual size/scale of the image.
I get why that this is happening because my text areas are staying in the same place on the image while the image has actually changed in size (respecting aspect ratio). So my question is, how do I get these text fields to move in respect to the image behind it getting larger while still keeping their relative position & size against the image?
Try removing the vertical text Days, Hrs, and Mins the image and use that as the background image.
Then make 3 separate images one for each Days, Hrs, and Mins.
From there use auto layout to do the following:
[Days image][00] [Hrs image][01] [Mins image][02]
I'm trying to create a PDF document from images of varying sizes so that each page of the PDF displays one of the images unscaled, the page size should fit the image dimensions.
I'm using Prawn to generate the PDF from a list of image file names. To get the image dimensions I use FastImage.
Prawn::Document.generate('Output.pdf') do
list_of_image_filenames.each do |i|
image_size = FastImage.size(i)
start_new_page(:size => image_size, :layout => :portrait)
image(i)
end
end
To test it I'm using three PNG files of dimensions 560x560, 600x600, and 600x600. I've made sure that FastImage returns the correct image dimensions.
The resulting PDF (Preview tells me it's PDF version 1.4) looks like this:
It starts with 3 empty pages (one of which is probably due to the fact that I didn't put anything on the first page), then the first image, which is cropped. Except the first one, which I'm ignoring for now, these pages are of size 560x560 px, according to Preview.
Next are two empty pages, then the second image, which also doesn't fit on the page. These pages have dimensions 600x600 px.
Finally, two more blank pages and the third image, cropped again, page dimensions also 600x600 px.
Here is a sample of one of the cropped images; the original image is a complete rounded rectangle with the digit "1" inside.
Why do the images not fit on the page? How can I put the individual unscaled images on pages fitting their dimensions?
May not be an exact answer but Probably too long for a comment. I have a few suggestions:
Have you tried specifying image size and position? e.g.
image(i,position: :left, vposition: :top, fit: image_size)
This will place an image in the top left corner of the document an will force it to fit in dimensions of the image_size Array. This might help with the cropping.
Also when setting page_size you need to pad for margins otherwise the image will not fit because it is outside the writable area try something like
image_size = FastImage.size(i)
#default margins are 0.5 inches so pad both height and width with 1 inch using in2pt
page_size = image_size.map{|p| p + in2pt(1) }
start_new_page(:size => page_size, :layout => :portrait)
I cannot guarantee this will work and it has not been tested but usually overflow onto additional pages has to do with the fact that you cannot place a specific object inside the bounds so padding the page size should help.
https://github.com/boazsegev/combine_pdf
you could try this gem.
cropped_size = [X0, Y0, X_max, Y_max]
combine_pdf = CombinePDF.new(pdf_path)
combine_pdf.pages.each{|page| page.crop(cropped_size)}
combine_pdf.save(new_pdf_path)
I have a Content Slider (All-in-one-banner sort of) on the home page of my website.
Every time this banner slides onto the next image in the queue, the other images (png format) on my page are getting pixelated. Especially it happens in Chrome.
Images and Icons such as the logos, icons used for navigation, etc... - they get pixelated when a new slide changes on the banner.
Please help me.
Demo link (Open in chrome):
When the slides in the banner change, Look at the logo on the top and the logos to the right, and also the profile pics below,: indiaemerge.com/ieys2013
The solution I could figure out is that one should NOT use an image with large dimensions.
For example: I was trying to use an image of size 800px X 400px to fit it into a division of 200px X 50px. Because of this the image was getting distorted when slides would change.
I reduced the dimensions and resolution of the image to match the target division's dimensions and it worked.
Another way to fix this is to use an svg image file.
So the lesson to be learnt here is that always try to use an image (in case it is png or jpg) whose size meets your requirement as precisely as possible. If it is an svg image file then there won't be any problem.
In product page, I have one main image and 4 other images coming as thumbnail. I have coded now so that if any of 4 image is clicked, it will be loaded in main image area.
Now the issue comes of size. If I put via resize, each image is resized. If I don't call resize(), then it will show original size without zoom in case of big image.
Can I have something where I find the width and height of thumb nail image too. Based on this, I can code in media.phtml to call Resize() or not.
Can anyone help please?
Jeff