Hi,
I'm trying to figure out how to reference images and other multimedia content from a page in Drupal.
I'm building a large multi-language site in Drupal 6 (about 7 languages, will expand in future). It's a business-style site rather than a community-style one, so the pages are reasonably static and will generally be originally implemented by web designers. Non-technical users will complete translations of pages and also small updates, fix typos etc.
How do I reference pictures that are related to a certain page (as opposed to part of the theme)? I understand I should store them in sites/sitename/files so I could reference them with src="sites/sitename/files/pic.jpeg", but it would make more sense to reference them using the PHP function file_directory_path(). However, if I embed PHP code into the page then the non-technical users are not able to edit the page unless I allow them to save PHP code. Does this all make sense? Am I working in the right direction? What should I do?
Thanks,
John
Quoting John Fletcher fletchnet@internode.net.au:
Hi,
I'm trying to figure out how to reference images and other multimedia content from a page in Drupal.
I'm building a large multi-language site in Drupal 6 (about 7 languages, will expand in future). It's a business-style site rather than a community-style one, so the pages are reasonably static and will generally be originally implemented by web designers. Non-technical users will complete translations of pages and also small updates, fix typos etc.
How do I reference pictures that are related to a certain page (as opposed to part of the theme)? I understand I should store them in sites/sitename/files so I could reference them with src="sites/sitename/files/pic.jpeg", but it would make more sense to reference them using the PHP function file_directory_path(). However, if I embed PHP code into the page then the non-technical users are not able to edit the page unless I allow them to save PHP code. Does this all make sense? Am I working in the right direction? What should I do?
You could write a module that would hook the node and manipulate a marker [img:picfile]. The hook would apply the file_directory_path and what else was needed to replace [img:picfile].
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
I'm trying to figure out how to reference images and other multimedia content from a page in Drupal.
It depends on you need those images in some very specific locations in the nodes, or if you just want to show them with the nodes. If it's the latter, you could just attach the images to the node (or a CCK Imagefield) and allow only editors/designers to control the attachments.
Domas
It's the former... I need them in locations on designed pages.
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Domas Sent: Friday, 22 February 2008 6:59 AM To: support@drupal.org Subject: Re: [support] Referencing images / multimedia content
I'm trying to figure out how to reference images and other multimedia content from a page in Drupal.
It depends on you need those images in some very specific locations in the nodes, or if you just want to show them with the nodes. If it's the latter, you could just attach the images to the node (or a CCK Imagefield) and allow only editors/designers to control the attachments.
Domas
Thanks Ernie,
That's certainly a solution. The main problem comes when you have multiple Drupal instances off one code base... or you just want to change some paths.
One idea would be to use symbolic links on my file system... I found another guy complaining about the same problem on the Drupal site and complaining that he had no better solution than symbolic links - which at least indicates that symbolic links is a solution.
Just link /files/sitename (or whatever you like) to /sites/sitename/files/
John
-----Original Message-----
You could write a module that would hook the node and manipulate a marker [img:picfile]. The hook would apply the file_directory_path and what else was needed to replace [img:picfile].
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Quoting John Fletcher fletchnet@internode.net.au:
Thanks Ernie,
That's certainly a solution. The main problem comes when you have multiple Drupal instances off one code base... or you just want to change some paths.
Not really a problem. You put the module in sites/all/modules/5.x/mymod or sites/all/modules/6.x/mymod to affect all sites in your multisite. If the module affects just one or two sites you put the module in sites/all/sample.com/modules/5.x/mymod, etc.
One idea would be to use symbolic links on my file system... I found another guy complaining about the same problem on the Drupal site and complaining that he had no better solution than symbolic links - which at least indicates that symbolic links is a solution.
I use symlinks. I have the core of Drupal in one place and symlink the root of the site to it. I also moved sites out of Drupal root and add a symlink for sites to the location I moved it because I also do have more than one version of Drupal installed and used.
Just link /files/sitename (or whatever you like) to /sites/sitename/files/
Certainly works but isn't what the original post wanted to solve.
John
-----Original Message-----
You could write a module that would hook the node and manipulate a marker [img:picfile]. The hook would apply the file_directory_path and what else was needed to replace [img:picfile].
This resolves the issue of ordinary users needing to input the IMG tag and have to format the correct path in the SRC argument. The picfile is only the filename and not the file path in full. The module would do its magic to correctly format the IMG with the proper SRC.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Quoting Earnie Boyd earnie@users.sourceforge.net:
Quoting John Fletcher fletchnet@internode.net.au:
Thanks Ernie,
That's certainly a solution. The main problem comes when you have multiple Drupal instances off one code base... or you just want to change some paths.
Not really a problem. You put the module in sites/all/modules/5.x/mymod or sites/all/modules/6.x/mymod to affect all sites in your multisite. If the module affects just one or two sites you put the module in sites/all/sample.com/modules/5.x/mymod, etc.
Correction substitute sites/all/sample.com/modules/5.x/mymod with this sites/sample.com/modules/5.x/mymod
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Quoting michel michel@ziobudda.net:
Earnie Boyd ha scritto:
sites/sample.com/modules/5.x/mymod
I have never see this directory name path (I intend 5.x/mymod)
It mean that I can use module 5.x for Drupal 6.x ?
No. It would store the 5.x modules for Drupal 5.x. While sites/sample.com/modules/6.x would store the 6.x modules. It is an upgrade path method I use so that I can quickly tell what modules I have for either version for the site. It is particularly important for this when using multi-site and you have sites/all/modules you need to identify the version because you could easily have more than one version running for each site.
NOTE: I symlink the sites directory. Install drupal to drupal/ cd drupal/ mv sites ../ ln -s ../sites sites
Then for new releases Install drupal-new-release to drupal-new/ cd drupal-new mv sites sites-orig ln -s ../sites sites
You want to review changes to core changes for sites-orig/default/settings.php and perhaps make similar adjustments to your settings.php files.
NOTE-2: I symlink the htdocs (or whatever it is called on your system) to drupal or drupal-new. ln -s drupal/ sample.com/htdocs ln -s drupal-new/ new.sample.com/htdocs
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/
Ernie,
I think you have misunderstood... I'm not concerned about modules, nor actually about allowing non-technical users to upload pictures.
My issue is that I've designed pages in full HTML/CSS, naturally including references to img files which exist on the page. Where should I put my images? If I put them all in sites/sitename/files then it will work but if I ever want to change the sitename or this path for some reason then all links to my images from my content will be broken.
This guy talks about the same problem: http://drupal.org/node/53705#comment-246019
I think symbolic links is the way to go. Then I have flexibility.
Regards, John
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Earnie Boyd Sent: Monday, 25 February 2008 2:41 AM To: support@drupal.org Subject: Re: [support] Referencing images / multimedia content
Quoting John Fletcher fletchnet@internode.net.au:
Thanks Ernie,
That's certainly a solution. The main problem comes when you have
multiple
Drupal instances off one code base... or you just want to change some
paths.
Not really a problem. You put the module in sites/all/modules/5.x/mymod or sites/all/modules/6.x/mymod to affect all sites in your multisite. If the module affects just one or two sites you put the module in sites/all/sample.com/modules/5.x/mymod, etc.
One idea would be to use symbolic links on my file system... I found
another
guy complaining about the same problem on the Drupal site and complaining that he had no better solution than symbolic links - which at least indicates that symbolic links is a solution.
I use symlinks. I have the core of Drupal in one place and symlink the root of the site to it. I also moved sites out of Drupal root and add a symlink for sites to the location I moved it because I also do have more than one version of Drupal installed and used.
Just link /files/sitename (or whatever you like) to /sites/sitename/files/
Certainly works but isn't what the original post wanted to solve.
John
-----Original Message-----
You could write a module that would hook the node and manipulate a marker [img:picfile]. The hook would apply the file_directory_path and what else was needed to replace [img:picfile].
This resolves the issue of ordinary users needing to input the IMG tag and have to format the correct path in the SRC argument. The picfile is only the filename and not the file path in full. The module would do its magic to correctly format the IMG with the proper SRC.
Earnie -- http://for-my-kids.com/ -- http://give-me-an-offer.com/