Torsten Baldes Posted February 18, 2014 Share Posted February 18, 2014 Is there any way to overwrite a file instead of appending a counter (filename-1.ext)? I have to use an image multiple times in a multiimage field and don't want to load several versions for the same image. thanks! Link to comment Share on other sites More sharing options...
Joss Posted February 18, 2014 Share Posted February 18, 2014 Quick question, why do you need to use the same image multiple times in the same field? This maybe something you can solve better at the template-file level http://processwire.com/api/fieldtypes/images/ Link to comment Share on other sites More sharing options...
Torsten Baldes Posted February 18, 2014 Author Share Posted February 18, 2014 oh, long story … it's for sizing (width, height, ratio) an element equal to the image next to it. this was a last minute request from my editors shortly before the launch of the website. kind of a dirty hack, but the the only way out, without a major revamp of the templates and fields. Link to comment Share on other sites More sharing options...
Joss Posted February 18, 2014 Share Posted February 18, 2014 Well dont forget you can resize the image using the api and create many different versions at the same time. And there is also the thumbnails module if you want to create a bespoke set of thumbnails at upload http://modules.processwire.com/modules/fieldtype-crop-image/ 1 Link to comment Share on other sites More sharing options...
Torsten Baldes Posted February 18, 2014 Author Share Posted February 18, 2014 hm, no sorry, i think i failed to explain my reasons clearly … i don't need a thumbnail. i need the exact same image or at least an image with the exact same dimensions. it doesn't show up in the frontend. it just defines the dimensions of a div, which has to be the same width and height as the image next to it. something like this: the div on the right side is set to position: relative; the image (visible here for explanation) is display: block and defines the dimensions of the div. the red div is set to position: absolute; top: 0; right: 0; bottom: 0; left: 0; this way, the text div will always be the same size as the image. but, never mind, i figured out another way, so this question can be closed/deleted. i just wanted to explain my weird wishes … Link to comment Share on other sites More sharing options...
adrian Posted February 18, 2014 Share Posted February 18, 2014 What about using $image->width and $image->height to get the size of the image. Although I am not sure if you are defining this in the template already anyway, or if you are grabbing it from the original uploaded image. Anyway, thought it might be of some help. Link to comment Share on other sites More sharing options...
Joss Posted February 18, 2014 Share Posted February 18, 2014 This is the sort of thing I normally either do with a bit of jquery - you can look at the height of the first div and then use JQuery to write the height and width into the second div. I cant remember if this is the plugin I used or not - but it is the same sort of thing: https://github.com/mattbanks/jQuery.equalHeights Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now